Open sumitx28 opened 3 days ago
1.1 Roles vs. Permissions Roles:
Definition: A role is a collection of permissions that define what actions a user assigned to that role can perform. Examples: ADMIN, USER, MANAGER, etc. Purpose: Simplifies permission management by grouping related permissions. Permissions:
Definition: A permission defines a specific action or access right within the application. Examples: CREATE_PROJECT, DELETE_TASK, VIEW_REPORTS, etc. Purpose: Provides fine-grained control over what actions can be performed. 1.2 Why Separate Roles and Permissions? Scalability: Easily add new roles or modify existing ones without altering the core logic. Flexibility: Assign multiple roles to a user, each with different permissions. Granularity: Manage permissions at a detailed level, allowing precise access control.
User: Represents application users. Role: Represents roles like ADMIN and USER. Permission: Represents specific permissions. User_Role: Join table linking users to roles. Permission_Role: Join table linking roles to permissions.
2.2 Database Schema User Table
id (Primary Key) username password email Other profile fields... Role Table
id (Primary Key) name (e.g., ADMIN, USER) Permission Table
id (Primary Key) name (e.g., CREATE_PROJECT, DELETE_TASK) User_Role Table
user_id (Foreign Key to User) role_id (Foreign Key to Role) Permission_Role Table
permission_id (Foreign Key to Permission) role_id (Foreign Key to Role)
Support RBAC
Currently supported roles: