Chau
Chau

Reputation: 5570

ASP.NET, how to manage users with different types of roles

I want to create a website with various users. The users can have different roles, admin and user, which is a very well documented situation. But I would like to also group the users on their location, so at each location I can have both admins and users. - A multi dimensional role system?

The reason is, that users in Germany should have access to a certain set of documents, while the Italian users shouldn't.

Where should I look for documentation on this specific topic? I need some way to limit my search, maybe some keywords.

Upvotes: 0

Views: 2193

Answers (3)

Greg
Greg

Reputation: 16680

First of all, please see the very excellent tutorial series on 4GuysFromRolla: https://web.archive.org/web/20210513220018/http://aspnet.4guysfromrolla.com/articles/120705-1.aspx

Secondly, the built in Role Provider is extremely rudimentary. You associate a user with a string (role) and that's pretty much it. There's no heirarchy or additional properties that you associate with the role, unless you pack in into the string (role name).

Upvotes: 1

Tomas Aschan
Tomas Aschan

Reputation: 60564

A different approach would be to add another set of roles, corresponding with the different locations available, for example Germany and Italy. You then make all German users members of the Germany role, and the German admins members of both Germany and Admin. When checking permissions, you then check both for Admin and for the current locale.

Remember, one user can have many roles.

Upvotes: 2

Paddy
Paddy

Reputation: 33857

You might want to look at custom profile properties. MSDN

Upvotes: 0

Related Questions