Role-Based Access Control Model
Users belong to teams and hold roles; roles bundle the permissions that actually gate an action — the object model behind most RBAC implementations.
Mermaid source
classDiagram
class User {
-string id
-string email
+hasPermission(action) bool
}
class Role {
-string name
+permissions() Permission[]
}
class Permission {
-string action
-string resource
}
class Team {
-string name
}
User "many" --> "many" Role : assigned
Role "many" --> "many" Permission : grants
Team "1" *-- "many" User : containsCategory: Architecture · Tags: rbac, auth, class-diagram
How to use this template
Choose Open in editor under the diagram to load this template into Mermaid Studio. Rename the boxes and arrows to match your own system, either in the code or on the visual canvas, then export it as PNG, SVG or JPEG, or copy the Mermaid code into a Markdown file. GitHub, GitLab, Notion and Obsidian all render Mermaid code blocks.
The Mermaid Class Diagram Syntax reference explains every construct this template uses, and the Class Diagram Generator page has more examples.
Related templates
- OAuth Login Flow — The authorization-code exchange between a browser, your app, and an identity provider.
- Microservices Architecture Map — How an API gateway fans out to independent services, each with its own datastore, plus the async event bus wiring billing and notifications to order events.