Handling multiple ABAC conditions #459
Unanswered
jeremywestwood
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Please take a look at this example https://github.com/openfga/sample-stores/blob/main/stores/groups-resource-attributes/store.fga.yaml. The idea is that you specify attributes in a single condition. Let me know if that helps, |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We are investigating using OpenFGA as part of our authorization layer but am running into a scenario which I feel like may have a better solution to what I am doing currently. OpenFGA is doing the right thing with the tuples provided (so its not a bug) but I'm looking for suggestions of how I could implement this kind of check in a better way to avoid the pitfalls or workarounds that I'm having to use.
Our model setup (very simplified and changed to fit a google doc type structure) looks like this (full test file: test-conditions.fga.yaml.txt):
Model
The key piece is that we have two ABAC checks which need to be done, which are linked together on a role (as in they should be checked together).
E.g. Role 1 is allowed to view
Documents
that are in theEditing
status in a particular folderRole 2 is allowed to view
Presentations
that are in theApproved
status in a particular folder.A user can have multiple roles
The issue comes in in that if you add both roles at the same time to the user, the condition checks are handled separately and so you get allowed access when you wouldn't expect it. (e.g. a user with both roles can view
Presentations in Editing
andDocuments in Approved
even though each role only gives half of the access)Example Tuples
Tests
You can see it in these test cases:
The first one passes correctly (by returning
false
), but ideally we would like the second one to also returnfalse
but it returnstrue
.Workarounds
Questions
Is there any other way to model this kind of requirement that I'm not thinking off?
Ideally it would be nice to be able to write the relation as:
define viewer: [role#member with status_check and type_check]
and then define the tuple with multiple conditions, but I realise that will take additional development.Apologies for the long post and thanks for any input!
Beta Was this translation helpful? Give feedback.
All reactions