ASP.NET, how to manage users with different types

2019-03-04 01:34发布

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.

标签: asp.net roles
3条回答
Root(大扎)
2楼-- · 2019-03-04 01:46

You might want to look at custom profile properties. MSDN

查看更多
地球回转人心会变
3楼-- · 2019-03-04 01:59

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.

查看更多
霸刀☆藐视天下
4楼-- · 2019-03-04 02:06

First of all, please see the very excellent tutorial series on 4GuysFromRolla: 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).

查看更多
登录 后发表回答