1: SyncUtils.PermissionGroupSetRole(web, "Super Member Group", "Blog Editor");
calling the routine below:
1: public Boolean PermissionGroupSetRole(SPWeb web, String groupName, String roleName)
2: {3: Boolean groupSet = false;
4: 5: try
6: { 7: SPRoleDefinition role = PermissionRoleExists(web, roleName);8: if (role == null) throw new ApplicationException("Role missing");
9: 10: foreach (SPRoleAssignment ra in web.RoleAssignments)
11: if (ra.Member.Name == groupName)
12: { 13: ra.RoleDefinitionBindings.RemoveAll(); 14: ra.RoleDefinitionBindings.Add(role); 15: ra.Update();16: groupSet = true;
17: break;
18: } 19: }20: catch (Exception ex)
21: {22: logErr = String.Format("PermissionGroupSetRole: {0}", ex.ToString());
23: } 24: 25: return groupSet;
26: }
No comments:
Post a Comment