RoleMaster is a powerful admin panel designed to streamline role-based access control (RBAC) by offering intuitive tools for user management, role management, and dynamic permissions. This documentation provides a comprehensive guide to RoleMaster, covering its core features, functionalities, project overview, and step-by-step setup instructions.
This project currently supports light mode only. Please ensure that your system theme is set to light mode to avoid any UI inconsistencies.
This guide will walk you through the process of cloning the RoleMaster repository, setting up the necessary dependencies, and running the project along with a mock REST API using json-server
. json-server
is a lightweight tool that quickly creates a mock REST API by serving data from a JSON file through RESTful endpoints.
-
Open a terminal or command prompt.
-
Clone the RoleMaster repository using the following command:
git clone https://github.com/Algoture/RoleMaster.git
- Navigate to the project directory:
cd RoleMaster
Before running the application, ensure all required dependencies are installed.
- Install the project's dependencies:
npm install
- Install
json-server
for the mock REST API:
- Globally :
npm install -g json-server
- Start the JSON Server:
npx json-server --watch db.json --port 3001
-
npx
: Executes thejson-server
package temporarily. -
--watch db.json
: Specifies the JSON file to be used as the data source. -
--port 3001
: Specifies the port number for the server (default is3000
). -
The mock API will now be available at
http://localhost:3001
.
Once you run the above npx
command, json-server
will create RESTful endpoints for the data in db.json
(e.g., /users
, /permissions
and /roles
).
- Start the RoleMaster application:
npm run dev
- Open your browser and navigate to
http://localhost:3000
.
-
Open two terminal windows or tabs.
-
In the first terminal, run the JSON Server:
npx json-server --watch db.json --port 3001
- In the second terminal, start the Next.js application:
npm run dev
You now have both the mock API (http://localhost:3001
) and the RoleMaster application (http://localhost:3000
) running.
RoleMaster provides robust user management capabilities, allowing administrators to:
-
View Users: Display a list of all users with their details, including name, email, role, status, and actions etc.
-
Search and Sort: Quickly find users with the search bar and sort them by status.
-
Add Users: Add new users by clicking the "Add User" button and filling out the required details.
-
Edit Users: Modify user details such as name, email, role, or status using the edit button.
-
Delete Users: Remove users from the system with a confirmation modal to prevent accidental deletions.
-
Manage User Status: Toggle between Active and Inactive statuses.
Administrators can efficiently manage roles with the following functionalities:
-
View Roles: Display a list of all defined roles and their associated permissions.
-
Add Roles: Create new roles using the "Add Role" button and define their permissions.
-
Edit Roles: Modify role names or associated permissions using the edit button.
-
Delete Roles: Remove roles from the system with a confirmation modal.
RoleMaster supports dynamic permission assignment for flexible role management:
-
Permission Overview: Display a clear list of permissions such as Read, Write, Delete, Modify, View etc.
-
Assign Permissions: Assign permissions to roles dynamically using the "Add Permission" button.
-
Modify Permissions: Edit existing permissions for any role.
-
Delete Permissions: Remove permissions with confirmation modals.
RoleMaster includes mock API simulation to validate CRUD operations:
-
User Management API: Simulates server responses for adding, editing, and deleting users.
-
Role Management API: Mocks role creation, editing, and deletion processes.
-
Permission Management API: Enables testing permission assignment and removal functionalities.
Effortlessly navigate between pages with a responsive sidebar.
- Dashboard: Quick access to system metrics and role statistics.
- Users: Navigate to the user management screen.
- Settings: Access system and role management configurations.
The Admin Panel Dashboard provides administrators with a high-level summary of the system's user and role statistics.
- Total Users: Displays the total number of users in the system.
- Active Users: Shows the count of currently active users.
- Inactive Users: Highlights the number of users who are currently inactive.
- These metrics are displayed in a card layout with distinct styles for easy identification.
- Provides a breakdown of user roles along with:
- Role Name: Displays roles such as Admin, Editor, Viewer, etc.
- Users Count: Number of users assigned to each role.
- Permissions Count: Total number of permissions associated with each role.
- Color-coded labels for roles enhance visual clarity.
- Present across User Management and Role Management.
- Allows administrators to quickly find specific users or roles by typing keywords.
- Enables sorting data by fields such as Name, or Status for improved usability.
- Displayed when deleting users, roles, or permissions to ensure no accidental actions occur.
-
Shown after performing actions like adding, editing, or deleting users, roles, or permissions.
-
Indicate success, failure, or validation errors for enhanced feedback.
- Fully optimized for both desktop and mobile devices, ensuring functionality on any screen size.
- Display summary statistics such as Total Users, Active Users, and Inactive Users in visually distinct cards.
- Shows key data for each role, including:
- Role Name
- User Count per Role
- Permissions Count
- View Users and Roles:
- Navigate to the "Users" or "Settings" tab to view lists of users and roles.
- Add a New User:
- Click the "Add User" button, fill out the form with user details, and assign a role.
- Edit User Details:
- Click the edit button next to a user’s entry and update the required information.
- Delete a User:
- Click the delete icon next to a user’s entry, confirm the deletion in the modal.
- Manage Roles:
- Use the "Add Role" or "Edit" options under the "Settings" tab to modify role configurations.
- Assign Permissions:
- Click "Add Permission" to assign new permissions to roles or edit existing ones.
- Access the Dashboard:
- The Dashboard provides an overview of key system metrics, including total users, active users, and inactive users.
- View Metrics: Check the cards on the Dashboard for an at-a-glance summary of user statistics.
- Role-Based Statistics: See a breakdown of roles and the number of users assigned to each role.
- API Simulation:
- Mock server calls can be tested by performing CRUD actions and viewing the simulated server responses.
-
Search Bar: At the top for quick filtering by name or email.
-
User List: Displays user details such as name, email, role, status, and actions.
-
Actions: Buttons for editing or deleting users.
-
Add User Button: Top-right button for adding a new user.
-
Status Indicators: Highlight whether users are active or inactive.
-
Roles Table: Displays a list of roles and their associated permissions.
-
Actions Column: Provides buttons for editing or deleting roles and permissions.
-
Add Role/Permission Buttons: Top-right buttons to add roles or permissions.
-
Metrics Cards: Displays key statistics such as Total Users, Active Users, and Inactive Users for a quick overview.
-
Role-Based Statistics: Displays a breakdown of roles with the number of users and permissions assigned to each.
-
Real-Time Data: Automatically updates the data displayed to reflect the most current information.
-
Navigation Links: Easy access to deeper management pages such as Users, Roles, and Settings.