We are building a cloud based application, using C# as our main language and running on Microsoft Azure. One of the key pieces of the architecture is to have fine grained authorization rights implemented for business logic in the application.
Open Policy Agent
We are looking at Open Policy Agent, as that seems to be a promising technology for these purposes. The example scenario/rules are described below. But it boils down to the scenario in something like a SharePoint library, or a Windows folder on the file system.
You have a hierarchy and you want to assign users with specific permissions to places in the hierarchy, where rights get inherited, but can be overridden deeper in the tree.
The platform we have will frequently update the permissions of users in the tree, and will constantly evaluate the policy agent to ask if a user has rights to perform a specific action on our platform.
Question
The question we have:
- Does someone has a good example in OpenPolicyAgent that implements something like a hierarchical/tree like permission policy?
- Are there other alternatives to OPA that are better suited for this?
Authorization rules
We have a tenant hierarchy that lists devices, defined like a tree structure:
+- Plant01
+- Line01
+- Device01
- Line02
+- Device02
- Device03
- Device04
+- Plant02
+- Line03
+- Device05
- Device06
- Device07
We also have people, defined in groups/users that we want to assign a specific role on a place in that hierarchy above.
Example:
- User01 can stop all devices of
Plant01-Line01
- User01 can only view devices of
Plant01-Line02
- User00 can stop all devices of
Plant01
- User00 must not stop
Plant01-Line02-Device04