anon
anon

Reputation: 51

How to Handle User Roles in SharePoint 2010

I have been charged with architecting an enterprise level custom application in SharePoint 2010 and I'm trying to figure out a good authorization scheme for users. The application must retrieve data from an existing LOB database and display bits and pieces of it granularly based on the user's role. Would it be better to use SharePoint's user profiles and add some custom attributes to handle this granular security, or ditch SharePoint's profiles and go the SQL Server route to store users and roles? Thanks.

Upvotes: 2

Views: 1390

Answers (2)

anon
anon

Reputation: 51

Ultimately we decided to use SQL Server for this. However, we also defined the high-level roles in SharePoint for driving the page navigation. Once on a particular page, the app code will check the SQL DB to figure out what page elements to display.

Upvotes: 0

Kyle Trauberman
Kyle Trauberman

Reputation: 25684

The easiest way to do this with SharePoint would be to create different groups for each of the "roles" and check if a user is a member of the appropriate group when processing code referencing protected action.

Its easy to do this:

SPGroup myGroup = SPContext.Current.Web.SiteGroups["My Group Name"];
if(myGroup.ContainsCurrentUser)
{
    // user is in the group, execute code necessary.
}

Upvotes: 1

Related Questions