0
votes

I am using asp.net 2.0 and have a different Sql Database table schema for User profiles and Roles. But my roles do not depend on directory based as the Default Asp.net membership component assumes. I had implemented by Custom Profile Provider with hints from here. Roles system i designed are based on set of permissions like CanDeletePost, CanCreatePost, CanFlagPost, admin will create a name for permission set and this will be role.

Example:

Rolename - moderator

Permissions - CanDeletePost, CanCreatePost, CanFlagPost

Question:

  • how should i realize this permission based role system using asp.net.
  • How is a membership different from a Role Provider. I still don't get it!!
1

1 Answers

2
votes

You can utilize the SqlRoleProvider to provide role-based permissions.

Whenever you want to show/use a function that requires a specific role, then just check, if the user is a member o that role (page.User.Identity.IsInrole('moderator'))

The difference between membership and role providers, goes into the difference between authentication and authorization. MembershipProviders are concerned about authentication, whereas roleProviders are concerned with authorization.