Add Membership in a Membership in a User Membership / Role

Being fairly new to the MVC Framework, I am trying to create my own membership provider that can support the concept of groups or departments.

I need to assign each user to belong to one (and only one) of several groups — each group (and its members) can only view records belonging to it — identified by GroupId.

I need to somehow save this groupid in the user profile so that when they log in and call (for example) the Index method on the controller, groupid is passed, which then filters the records that the user can see.

I'm sure this is a simple approach, but I seem to have a mental block.

Any insight would be helpful (and probably vaguely simple!)

Roger

+5
source share
1 answer

I wonder if you can use "roles" instead of "groups." Permissions can be easily handled by roles. Usually a role is something like an administrator, manager, superuser, user, guest. But could you use the roles for your own purposes?

This explains the use of roles in the membership provider: How to use the role manager in ASP.NET 2.0 . You can find a lot more by looking for "roles" instead of "groups."

And if you don’t have the participant’s source code as a link, you can download it from this page. Microsoft ASP.NET 2.0 Providers: Introduction to find out how they encode roles in the basic version.

+2

All Articles