[ OK ] stripe-sd-11 — full content available
[ INFO ] category: System Design difficulty: medium freq: Must first seen: 2026-04-20
[MEDIUM][SYSTEM DESIGN][MUST]
$ cat problem.md
Design an Access Management System - Stripe System Design Interview | ShowOffer
Problem Statement:
Design a system that manages access to various resources within an organization. The system should support the following functionalities:
-
User Management:
- Add a new user.
- Delete an existing user.
- Update user information (e.g., name, email).
-
Role Management:
- Create a new role.
- Delete an existing role.
- Update role information (e.g., role name, description).
-
Access Control:
- Assign a role to a user.
- Remove a role from a user.
- Check if a user has a specific role.
-
Resource Management:
- Add a new resource.
- Delete an existing resource.
- Update resource information (e.g., resource name, description).
-
Permission Management:
- Assign a permission to a role for a specific resource.
- Remove a permission from a role for a specific resource.
- Check if a user has permission to access a specific resource.
Examples:
- Add a new user with ID 1 and name "John Doe".
- Create a new role with ID 1 and name "Admin".
- Assign the "Admin" role to user 1.
- Add a new resource with ID 1 and name "Database".
- Assign the permission "read" to the "Admin" role for resource 1.
- Check if user 1 has permission to read resource 1.
Constraints:
- The system should support a large number of users, roles, resources, and permissions.
- The system should handle concurrent access and modifications efficiently.
- The system should provide real-time access control checks.
Hints:
- Consider using a relational database to store user, role, resource, and permission data.
- Use caching to improve the performance of access control checks.
- Implement transactional consistency to ensure data integrity.
Solution:
To design an Access Management System, we can follow these steps:
-
Database Design:
- Create tables for Users, Roles, Resources, and Permissions.
- Create join tables for User_Roles and Role_Permissions to manage many-to-many relationships.
-
API Design:
- Implement RESTful APIs for user, role, resource, and permission management.
- Use POST, PUT, DELETE, and GET methods for CRUD operations.
-
Access Control Logic:
- Implement a function to check if a user has a specific role by querying the User_Roles table.
- Implement a function to check if a user has permission to access a specific resource by querying the Role_Permissions table.
-
Caching:
- Cache user roles and permissions to improve the performance of access control checks.
- Invalidate the cache when user roles or permissions are updated.
-
Concurrency Handling:
- Use database transactions to ensure consistency when updating user roles or permissions.
- Implement optimistic concurrency control to handle concurrent modifications.
-
Real-time Access Control:
- Use WebSockets or long polling to provide real-time updates to clients when user roles or permissions change.
By following these steps, we can design a scalable and efficient Access Management System that meets the requirements of the problem statement.
ShowOffer Interview Question