I am looking into on how to design, and develop a RBAC system that limits and enforces access to a product base on roles and permissions. This is something I wanted to try for fun because it seems interesting. However, I am unsure how to go from actually designing it. I was thinking on implementing it as a library. Would like some guidance in good approaches that I can look into or try out. Thank you!
Can it be done without the use of proxy or other frameworks/libraries? Say, I was thinking just implementing the system with a Role class, permission class, User class, and a role manager class.
Is this some kind of client/server system, where a client connects to a server and wants to perform some operations? If so, first of all, you need to authorize (identify) the user, e.g. by using TLS Client Certificate or by using UserName + Password. Once the user has been authorized successfully, i.e. when your server knows to whom it is talking, you can figure what permissions that user has. So, you have to look up the user's roles from the server's user database. Next, you have to compute the union of allpermissions of all roles that the user has. Finally, you can decide whether the user has the required permission to perform the requested operation...
At least for the user database, which you will need, I'd recommend to use an existing library, such as SQLite or MySQL Connector/C.