可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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.
回答1:
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.
回答2:
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).
回答3:
You might want to look at custom profile properties. MSDN