This project is a technical assessment, a Role-Based Access Control (RBAC) system designed to handle multiple tenants. It aims to provide a flexible and scalable solution for managing users, roles, permissions, and products across different tenants. The repository for this project can be found at https://github.com/omarAboElWafa/rbac-multi-tenants-system.
The requirements for this system are categorized using the MoSCoW prioritization:
- Multi-tenant support to segregate data and operations by tenant.
- Role-based access control to manage permissions for different roles within tenants.
- User management, including registration, authentication, and role assignment.
- CRUD operations for products, linked to specific tenants.
- Database schema to support multi-tenancy and RBAC.
- API documentation and endpoint structure.
- Logging and monitoring for system operations and user activities.
- Unit and integration tests to ensure system reliability.
- Secure password storage and authentication mechanisms.
- User interface for managing tenants, users, roles, and products.
- Reporting and analytics features for administrative users.
- Integration with external authentication providers (e.g., OAuth).
- Support for non-relational databases.
- Features specific to non-web applications.
This section outlines the technical method to address the requirements, including the architecture design, database schema, and component diagrams.
[plantuml, ERD, png] ../../mnt/data/ERD.PNG
The database schema is designed to support multi-tenancy and RBAC. The following tables are included:
- TENANTS: Stores information about each tenant.
- USERS: Stores user data, including email, password, tenant ID, and role ID.
- ROLES: Defines roles with specific permissions.
- PERMISSIONS: Manages the relationship between users and roles.
- PRODUCTS: Stores product information linked to tenants.
The implementation involves the following steps:
- Set up the database using the provided schema.
- Implement user authentication and authorization.
- Create APIs for managing tenants, users, roles, and products.
- Ensure secure password storage using hashing algorithms.
- Develop unit and integration tests.
- Document the API endpoints.
The implementation will be tracked using the following milestones:
- Database setup and schema creation.
- User authentication and authorization implementation.
- API development for tenant, user, role, and product management.
- Testing and quality assurance.
- Final deployment and documentation.
To evaluate the success of the system, the following metrics will be used:
- Successful multi-tenant data segregation.
- Role-based access control accuracy.
- System performance under load.
- User feedback on functionality and usability.