Question

Need to automate the custom permission level creation and groups.

Please give me some pointers which can guide me to create a feature to add a custom permission level and groups and staple the same with site def

Was it helpful?

Solution

As far as writing a feature, I've outlined how to do that with event receivers here.

You'll just need to replace the code to add event receivers with your code to add permission levels and groups. Also, at the bottom of the post I talk about how to staple it to a specific site definition.

Permission levels are called roles in the api. You will want to create a new SPRoleDefinition, configure the name and basepermissions, and then add it to the SPWeb.RoleDefinitions collection.

Groups are called groups in the api. You will want to call SPWeb.Groups.Add to create a group.

I hope this all makes sense.

OTHER TIPS

As Steve suggests, SPRoleDefinition is the way to go together with SPRoleAssignment. If you are migrating from SharePoint 2003 to SharePoint 2007 your SPRole class would still work but I suggest migrating that part of code to the new classes.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top