Roles & Permissions
These entities determine what an authenticated actor is allowed to do.
Entities
- Role: A named collection of permissions.
- Permission: The right to perform an action on a type of resource.
- Role Assignment: The grant of a role to an actor, within a defined scope.
- Policy: A rule that allows or denies access based on attributes and context.
- Resource: An object in the application that access is controlled on.
- Relationship: A recorded connection between an actor and a resource, such as owner or viewer.
Model
Rendering diagram…
Diagram source
erDiagram
ROLE }o--o{ PERMISSION : grants
ROLE ||--o{ ROLE_ASSIGNMENT : assigned_by
MEMBERSHIP ||--o{ ROLE_ASSIGNMENT : receives
RESOURCE ||--o{ RELATIONSHIP : connected_by
POLICY }o--o{ RESOURCE : governs
Key Rules
- Code checks permissions, not roles. Roles can then change without changing the application.
- Assignments have a scope. A role applies to an organization, a team, or a single resource, and never beyond it.
- Access is denied by default. An actor can do only what a role, relationship, or policy explicitly allows.