コード例 #1
0
 public IEnumerable <Permission> GetEffectivePermissions(Role role)
 {
     if (role != null)
     {
         return(PermissionUtils.CompactToEffective(Db.RoleBuilder.GetPermissions(role)));
     }
     return(null);
 }
コード例 #2
0
 public IEnumerable <Permission> GetEffectivePermissions(Role role)
 {
     if (role != null)
     {
         return(PermissionUtils.CompactToEffective(RoleMembershipMemorySet.Instance.GetEffectiveAssignments(role.Id)));
     }
     return(null);
 }
コード例 #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);
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 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);
 }
コード例 #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);
 }
コード例 #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);
 }