Exemplo n.º 1
0
 public SPDGServerRoleAssignment(SPDGPrincipal member)
     : base(member, new List<SPDGRoleDefinition>())
 {
     if (member is SPDGServerUser)
     {
         _roleAssignment = new SPRoleAssignment(((SPDGServerUser) member).SPUser);
     }
     else
     {
         _roleAssignment = new SPRoleAssignment(((SPDGServerGroup) member).Group);
     }
 }
 public static SPDGRoleAssignment GetRoleAssignmentByPrincipal(SecurableObject securableObject, ClientContext context, SPDGPrincipal principal)
 {
     var principalId = principal.ID;
     var roleAss = securableObject.RoleAssignments.Where(x => x.PrincipalId == principalId).Include(x => x.RoleDefinitionBindings, x => x.Member, x => x.PrincipalId);
     var results = context.LoadQuery(roleAss);
     context.ExecuteQuery();
     if (results.Any())
     {
         return new SPDGClientRoleAssignment(results.First(), principal, results.First().RoleDefinitionBindings.Select(x => new SPDGClientRoleDefinition(x)));
     }
     else
     {
         return null;
     }
 }
 public static void AddRoleAssignment(SPSecurableObject securableObject, SPDGPrincipal principal, IEnumerable<SPDGRoleDefinition> roleDefinitions)
 {
     SPPrincipal spPrincipal;
     if (principal is SPDGServerUser)
     {
         spPrincipal = ((SPDGServerUser)principal).SPUser;
     }
     else
     {
         spPrincipal = ((SPDGServerGroup)principal).Group;
     }
     SPRoleAssignment roleAss = new SPRoleAssignment(spPrincipal);
     foreach (var spdgRoleDefinition in roleDefinitions)
     {
         var spRoleDef = ((SPDGServerRoleDefinition)spdgRoleDefinition).RoleDefinition;
         roleAss.RoleDefinitionBindings.Add(spRoleDef);
     }
     securableObject.RoleAssignments.Add(roleAss);
 }
 public static void AddRoleAssignment(SecurableObject securableObject, ClientContext context, SPDGPrincipal principal, IEnumerable<SPDGRoleDefinition> roleDefinitions)
 {
     Principal p;
     if (principal is SPDGClientUser)
     {
         p = ((SPDGClientUser)principal).User;
     }
     else
     {
         p = ((SPDGClientGroup)principal).Group;
     }
     var roleDefinitionBindingCollection = new RoleDefinitionBindingCollection(context);
     foreach (var spdgRoleDefinition in roleDefinitions)
     {
         roleDefinitionBindingCollection.Add(((SPDGClientRoleDefinition)spdgRoleDefinition).Definition);
     }
     securableObject.RoleAssignments.Add(p, roleDefinitionBindingCollection);
     context.ExecuteQuery();
 }
 public static SPDGRoleAssignment GetRoleAssignmentByPrincipal(SPSecurableObject securableObject, SPDGPrincipal principal)
 {
     SPPrincipal spPrincipal;
     if (principal is SPDGServerUser)
     {
         spPrincipal = ((SPDGServerUser)principal).SPUser;
     }
     else
     {
         spPrincipal = ((SPDGServerGroup)principal).Group;
     }
     try
     {
         var spRoleAss = securableObject.RoleAssignments.GetAssignmentByPrincipal(spPrincipal);
         return new SPDGServerRoleAssignment(spRoleAss, principal, spRoleAss.RoleDefinitionBindings.Cast<SPRoleDefinition>().Select(x => (SPDGRoleDefinition)new SPDGServerRoleDefinition(x)));
     }
     catch (Exception)
     {
         //ugly but will do
         return null;
     }
 }
Exemplo n.º 6
0
 public override SPDGRoleAssignment GetRoleAssignmentByPrincipal(SPDGPrincipal principal)
 {
     return ServerRoleAssignmentHelper.GetRoleAssignmentByPrincipal(_item, principal);
 }
Exemplo n.º 7
0
 public override void AddRoleAssignment(SPDGPrincipal principal, IEnumerable<SPDGRoleDefinition> roledefinitions)
 {
     ServerRoleAssignmentHelper.AddRoleAssignment(_item, principal, roledefinitions);
 }
Exemplo n.º 8
0
 public SPDGServerRoleAssignment(SPRoleAssignment roleAssignment, SPDGPrincipal member, IEnumerable<SPDGRoleDefinition> roleDefinitionBindings)
     : base(member, roleDefinitionBindings)
 {
     _roleAssignment = roleAssignment;
 }
Exemplo n.º 9
0
 public abstract SPDGRoleAssignment GetRoleAssignmentByPrincipal(SPDGPrincipal principal);
Exemplo n.º 10
0
 public abstract void AddRoleAssignment(SPDGPrincipal principal, IEnumerable <SPDGRoleDefinition> roledefinitions);
Exemplo n.º 11
0
 public SPDGClientRoleAssignment(SPDGPrincipal member)
     : base(member, new List<SPDGRoleDefinition>())
 {
 }
Exemplo n.º 12
0
 public override SPDGRoleAssignment GetRoleAssignmentByPrincipal(SPDGPrincipal principal)
 {
     return ClientRoleAssignmentHelper.GetRoleAssignmentByPrincipal(_web, _context, principal);
 }
Exemplo n.º 13
0
 public override void AddRoleAssignment(SPDGPrincipal principal, IEnumerable<SPDGRoleDefinition> roledefinitions)
 {
     ClientRoleAssignmentHelper.AddRoleAssignment(_web, _context, principal, roledefinitions);
 }
Exemplo n.º 14
0
 public SPDGRoleAssignment(SPDGPrincipal principal, IEnumerable <SPDGRoleDefinition> roleDefinitionBindings)
 {
     Member = principal;
     RoleDefinitionBindings = roleDefinitionBindings;
 }
Exemplo n.º 15
0
 public abstract void AddRoleAssignment(SPDGPrincipal principal, IEnumerable<SPDGRoleDefinition> roledefinitions);
Exemplo n.º 16
0
 public SPDGRoleAssignment(SPDGPrincipal principal, IEnumerable<SPDGRoleDefinition> roleDefinitionBindings)
 {
     Member = principal;
     RoleDefinitionBindings = roleDefinitionBindings;
 }
Exemplo n.º 17
0
 public abstract SPDGRoleAssignment GetRoleAssignmentByPrincipal(SPDGPrincipal principal);