internal void AddRange(SPSecurable securable, IEnumerable <RoleAssignment> roleAss)
 {
     foreach (RoleAssignment ass in roleAss)
     {
         _list.Add(SPPermission.ResolvePermission(ass, securable));
     }
 }
 internal SPPermission(SPSecurable securable, RoleAssignment ass)
 {
     if (!ass.IsPropertyReady(a => a.Member.Title))
     {
         CTX.Lae(ass, true, a => a.Member.Title, a => a.Member.PrincipalType,
                 a => a.Member.LoginName, a => a.Member.Id, a => a.RoleDefinitionBindings);
     }
     _memTit         = ass.Member.Title;
     _memLog         = ass.Member.Id;
     _perms          = ParseBindings(ass.RoleDefinitionBindings);
     _prinType       = ass.Member.PrincipalType;
     this.LoginName  = ass.Member.LoginName;
     this.ObjectId   = securable.Id;
     this.ObjectName = securable.Name;
     _roleAss        = ass;
 }
        public static SPPermissionCollection ResolvePermissions(SPSecurable securable)
        {
            var roleAss = securable.SecObj.RoleAssignments;

            if (!roleAss.AreItemsAvailable)
            {
                CTX.Lae(roleAss, true, col => col.Include(
                            ass => ass.Member, ass => ass.RoleDefinitionBindings.Include(
                                d => d.Name, d => d.Description)));
            }

            var permCol = new SPPermissionCollection(roleAss.Count);

            foreach (var ass in roleAss)
            {
                permCol._list.Add(SPPermission.ResolvePermission(ass, securable));
            }
            return(permCol);
        }
 public static SPPermission ResolvePermission(RoleAssignment ass, SPSecurable securable) =>
 new SPPermission(securable, ass);