Reputation: 664
Here's my problem: I'm working on an application where the users have certain rights. Depending on these rights, they would have access to some functions.
My problem is that I would have to test for every case if the user has the rights or not and enable it or not. For a big app, this task is quite tiring. I want to ask if there is a design pattern or library that simplifies the management of this. My goal is to disable buttons when the user does not have proper permissions.
Upvotes: 0
Views: 1919
Reputation: 1449
Multiple things needs to be considered for such a solution
In an idea scenario, I will have following way of dealing with this problem.
I will have user belonging to USergroup and Roles assigned to each Usergroup in some database.
When the user logins to the application, you can fetch the usergroup and associated user roles from the database.
Just want to keep it short and simple.
Upvotes: 1