Object-based permissions based on Tenant Group #5483
-
Hi everyone, I'm trying to use the Tenant Group to assign permissions to objects belonging to any tenant within a tenant group. The Tenant Group does not appear to be directly associated with the object (in this case, a Rack) nor do the current examples in the documentation seem to describe how I might go about this. I think what I need to do is somehow recursively get a flattened array of all tenants that exist within a tenant group (which according to the documentation can also be hierarchical) and do something like this:
But for someone not familiar with the Django ORM, I'm having a bit of trouble. Any ideas? Thanks! Bill Fehring |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You can access related objects using a dunder (double underscore). So for example, to match all objects assigned to a tenant within the tenant group "Customers", you could do |
Beta Was this translation helpful? Give feedback.
You can access related objects using a dunder (double underscore). So for example, to match all objects assigned to a tenant within the tenant group "Customers", you could do
{"tenant__group__name": "Customers"}
.