// Authorize implements the Authorizer interface.
Authorize implements the Authorizer interface.
// Authorize implements the Authorizer interface .
func (rs resources) Authorize(subject string, permission Permission, resource, tenant string) bool {
	ts, ok := rs[resource]
	if !ok {
		return false
	}
	t, ok := ts[tenant]
	if !ok {
		return false
	}
	switch permission {
	case Read:
		_, ok := t.read[subject]
		return ok
	case Write:
		_, ok := t.write[subject]
		return ok
	}
	return false
}
func ( rs resources ) Authorize ( subject string , permission Permission , resource , tenant string ) bool { ts , ok := rs [ resource ] if ! ok { return false } t , ok := ts [ tenant ] if ! ok { return false } switch permission { case Read : _ , ok := t . read [ subject ] return ok case Write : _ , ok := t . write [ subject ] return ok } return false }
Authorize implements the Authorizer interface.
Authorize implements the Authorizer interface .