Beispiel #1
0
 public IEnumerable <Permission> GetEffectivePermissions(Role role)
 {
     if (role != null)
     {
         return(PermissionUtils.CompactToEffective(Db.RoleBuilder.GetPermissions(role)));
     }
     return(null);
 }
 public IEnumerable <Permission> GetEffectivePermissions(Role role)
 {
     if (role != null)
     {
         return(PermissionUtils.CompactToEffective(RoleMembershipMemorySet.Instance.GetEffectiveAssignments(role.Id)));
     }
     return(null);
 }
Beispiel #3
0
 public IEnumerable <Permission> GetPermissions(IUserIdentity user)
 {
     if (user != null)
     {
         HashSet <PermissionAssignment> perms = new HashSet <PermissionAssignment>();
         Db.RoleBuilder.Fill(perms, Db.RoleBuilder.GetRoles(user));
         return(PermissionUtils.CompactToEffective(perms));
     }
     return(null);
 }
 public IEnumerable <Permission> GetPermissions(Role role)
 {
     if (role != null)
     {
         HashSet <PermissionAssignment> perms = new HashSet <PermissionAssignment>();
         RoleMembershipMemorySet.Instance.Fill(perms, role.Id);
         return(PermissionUtils.CompactToEffective(perms));
     }
     return(null);
 }
 public IEnumerable <Permission> GetPermissions(IUserIdentity user)
 {
     if (user != null)
     {
         HashSet <Guid> roleids = RoleMembershipMemorySet.Instance.AllRolesForUser(user.Uid);
         if (roleids != null)
         {
             return(PermissionUtils.CompactToEffective(RoleMembershipMemorySet.Instance.GetEffectiveAssignments(roleids)));
         }
     }
     return(null);
 }
Beispiel #6
0
 //Directly assigned, no cascade
 public IEnumerable <Permission> GetPermissions(Role role)
 {
     if (role != null)
     {
         IPermissionProvider prov = AuthorizationManager.Instance.GetPermissionProvider(this.context);
         if (prov != null)
         {
             HashSet <PermissionAssignment> perm = new HashSet <PermissionAssignment>();
             Db.RoleBuilder.Fill(perm, role, prov);
             return(PermissionUtils.CompactToEffective(perm));
         }
     }
     return(null);
 }
Beispiel #7
0
 public bool HasPermission(IUserIdentity user, Permission permission)
 {
     if (user != null && permission != null)
     {
         HashSet <PermissionAssignment> perms = new HashSet <PermissionAssignment>();
         Db.RoleBuilder.Fill(perms, Db.RoleBuilder.ExpandRoles(user));
         IEnumerable <Permission> p = PermissionUtils.CompactToEffective(perms);
         if (p != null)
         {
             foreach (Permission pp in p)
             {
                 if (permission.Equals(pp))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }