Skip to content

[Question] Users/Tenants/Roles/Objects/Actions how to model? #1191

@iGrog

Description

@iGrog

Want to prioritize this issue? Try:

issuehunt-to-marktext

What's your scenario? What do you want to achieve?

I have users, tenants, roles, objects and actions like this:

users:

- user_1
- user_2
- ...

tenants:

- tenant_1
- tenant_2
- ...

roles:

  • ordersManager (must have access to objects:actions like orders:(view|create|update|delete) in own tenant)
  • ordersAssistant (must have access to one object -> orders:view in own tenant
  • accountant (access to invoices:(view, create, update, delete) in own tenant
  • admin (access to all objects:actions in own tenant)
  • superadmin (access to all object:actions in any tenants)

How bindings will look like:

  • user_1 is ordersManager in tenant_1
  • user_2 is accountant in tenant_1
  • user_3 is admin in tenant_2
  • user_4 is superadmin

additionally, any explicit rule can be applied to any user/tenant like:
user_5 in tenant_1 has access to orders:list.

I tried to model policy for all this, but without any luck

p, superadmin, *, *, *
p, ordersAssistant, *, orders, list

g, user:1, ordersAssistant, tenant:1	

#roles?
g, admin, superadmin
g, accountant, admin
g, ordersAssistant, admin
g, ordersManager, admin
g, ordersAssistant, ordersManager

but I don’t understand at all how to write all these roles, objects and actions in policy definition?
could someone help me?

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions