Last week I worked on a pretty basic Sharepoint requirement but while developing the solution I came across few interesting things which I am going to share here.
Requirement:
The overall requirement was to provide a document sharing web application which can be accessed by different types of users with different permissions on different documents. Also all these users would be stored in SQL Server database.
Solution:
My solution to this was to create a set of Groups and Document Libraries in Sharepoint. Assign Groups to Document Libraries with Specific permissions and then add Users to these Groups via a Custom Membership Provider. Here is how I am implementing it.
Initial MOSS Configuration:
-
Create a web application and a default site collection
-
-
-
Configure the Custom Membership Provider
-
Create Document Libraries
The next steps were to write the following pieces of interesting code:
[Create Site Groups]

[Assign Site Level Roles to Groups]
[Add Groups to Document Libraries with Roles]
The important thing to note here is the “BreakRoleInheritance” method which I had to add to remove this error:
“This operation is not allowed on a object that inherits permissions.”
[Add Users to Groups]
The field “loginName” here accepts a semicolon delimited string where the first value is the ‘CustomMembershipProvider’ name assigned in the web.config file.
Apart from few initial configuration issues in the FBA the code is now working all ok in the Proof Of Concept project. I am going to integrate the same in my LIVE Project and would post any more useful stuff.