My blog has moved!

Visit http://blog.adamroderick.com/ and update your bookmarks.

Tuesday, November 3, 2009

Adding FBA Users to SharePoint Groups

We had a client that wanted to use a custom user database to authenticate users within SharePoint.  We first wrote a simple implementation of a custom membership provider for forms-based authentication.  Then we followed the necessary steps of setting up zones and modifying the web.config files with the membership information. 

The problem we ran into was the custom user database had no concept of roles.  In previous projects, I was able to grant access to the right users to the right places in SharePoint by manually granting access to a handful of roles, and allowing the users to continue to maintain user-role relationships as they always had.  In this implementation, we needed to figure out a way to programmatically grant FBA users access to the SharePoint site.  The code turned out to be pretty straightforward:

image

If you already have an SPWeb object from an existing SPContext, you do not need to create a new SPSite or SPWeb like I have done above.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home