I’m using the standard .NET authentication database tables and code, with .NET 4.0, C# and MVC 3.
Basically, I want to have roles (which are included in the framework), and then be able to assign permissions to those roles (which are not included, as far as I know).
So I want to assign permissions to roles. A user in the Accountant role couldn’t edit and delete employees, but a user in the Administrator role could. Since these permissions could change at any time, instead of checking User.IsInRole("Administrator"), I’d like to do something like User.HasPermission("EditEmployee").
I could probably design some custom tables and code myself, but I’d rather use the .NET Framework if it’s already built-in. Is there anything like this? If not, is there a library out there that does do this?
Maybe you could simply add another role to user who can edits employees. Something like “CanEditEmployee” and then verify if user is in role “CanEditEmployee”? This is what I do when I must have to do something similar.