**modelling separate view and admin_view
# spicedb
c
modelling separate view and admin_view permissions Imagine you have a multi-tenant application where organisations can have multiple projects and a bunch of sharable resources with CRUD permissions under those projects. Organisation members work in projects but organisation admins can view all projects. To not bloat the project listing page for admins you want the option for them to toggle and only list those project which they have created, or directly/via group membership been made a
viewer
of. How would i model this schema?
The only alternative i've thought about how to solve this is creating a duplication of all CRUD permissions prefixed e.g. with
admin
and whenever you want to check if a user is can e.g. edit something you have to check both the regular
edit
permission and the
admin_edit
and when an admin just want to list projects they are involved with they would list just based on the
view
but when they want to see everything they would list based on
admin_view
but i don't like this approach as it bloats the schema
y
what you're describing sounds sane to me
i'm not sure what the alternative would be
i guess if we had something like https://github.com/authzed/spicedb/issues/1317 for checks as well it would let you supply the organization relation as a filter
but as it currently stands, adding admin variations and then checking those specifically is the way i would go
if you just want to break things up, you could use the
partial
feature from composable schemas
c
Okay thanks for the sanity check 🙏
yeah that issue details something very requested, looking forward to the day it comes! 😄
s
We had a similar scenario and solved it like this: definition core/group { relation system: core/system relation owner: core/user relation member: core/user permission view = system->view_groups + owner + member permission membership = owner + member } Direct memberships are queried via the
membership
permission and
view
handles both cases, direct and indirect.
6 Views