kamagra how much to take

Easy Way To Add Role Assignments

I have to do this all the time. If you have a similar requirement, just use the following method:

  1. public static void AddRoleAssignment(ISecurableObject securable, SPPrincipal principal, SPRoleDefinition[] roleDefinitions)
  2. {
  3. var roleDefinitionBindings = new SPRoleDefinitionBindingCollection();
  4. foreach (SPRoleDefinition definition in roleDefinitions)
  5. {
  6. roleDefinitionBindings.Add(definition);
  7. }
  8. var roleAssignment = new SPRoleAssignment(principal);
  9. roleAssignment.ImportRoleDefinitionBindings(roleDefinitionBindings);
  10. securable.RoleAssignments.Add(roleAssignment);
  11. }

The usage of it is pretty straightforward, you have an ISecurableObject parameter to expose role assignments for an object, an SPPrincipal to represent a user or group, and a SPRoleDefinition array to act as a container for role definitions.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>