Could objects, not subjects, have caveats? Or is there a way to add conditionals to permissions? #1933
-
I am looking to migrate our existing auth logic over to spicedb. We are almost there. However, we have run into an issue. We have a platform with numerous tenants/organisations and accounts associated with tenants. There is a certain resource which accounts/users can create and share within their tenancy with other groups or accounts. These resources can also be overtaken by the platform admin and be made generally available (platform reserved). However, in this case the owner or accounts who have access to edit or delete the resource, lose this permission. Is there a way to have caveats associated with objects but not subjects or someway to have conditional permissions if certain relationships exists? Original resource definition
Possible Approach 1
OR Possible Approach 2
Apologies, if I am missing an obvious way to achieve this. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The current way is to have a reference to the resource itself, and caveat that:
You'd only write the |
Beta Was this translation helpful? Give feedback.
-
@josephschorr Thank you very much for your prompt reply! Your solution works and its just what we needed! I will run further tests, but it is looking quite promising. To anyone else looking for the final solution. I have combined @josephschorr's answer
Test Relationships
Assertions
|
Beta Was this translation helpful? Give feedback.
The current way is to have a reference to the resource itself, and caveat that:
You'd only write the
platform_reserved
(pointing to the same resource) if that condition existed. You can similarly caveat that "self relationship" to assign a caveat on the object itself