-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
In the docs there is a note where the decision not to have multiple matchers is left open for discussion. Here is the use case I have where I use multiple matchers, and some code that I use currently to do it:
I have a role with a pattern "foo/bar/" that grants an access level of "read/write" to a user.
I have another role with a pattern "foo/bar/secret/" that restricts access to "read".
I give a user both the above roles and I expect the following behavior:
Enforce(user, "foo/bar/baz", "write") -> true
Enforce(user, "foo/bar/secret/baz", "write") -> false
In order to do this I created a "negative" matcher. When I find a role where access is granted I do a check for a role that matches the "negative" of the above role:
<REDACTED>This "works" of course, but it does illustrate that these "negative" matchers are necessary in order to support this sort of RBAC scenario.