示例#1
0
 public void CheckUserAuthorized(AdministratorId administratorId)
 {
     if (!Administrators.Contains(administratorId))
     {
         Fail(administratorId);
     }
 }
示例#2
0
 public void RemoveAdministrator(User u)
 {
     if (Administrators.Contains(u))
     {
         Administrators.Remove(u);
     }
 }
 /// <summary>Find out if a principal has a certain permission by default.</summary>
 /// <param name="user">The principal to check for allowance.</param>
 /// <param name="permission">The type of permission to map against.</param>
 /// <returns>True if the system is configured to allow the user to the given permission.</returns>
 public virtual bool IsAuthorized(IPrincipal user, Permission permission)
 {
     return((Administrators.MapsTo(permission) && Administrators.Contains(user)) ||
            (Editors.MapsTo(permission) && Editors.Contains(user)) ||
            (Writers.MapsTo(permission) && Writers.Contains(user)));
 }
 /// <summary>Find out if a princpial has admin access.</summary>
 /// <param name="user">The princpial to check.</param>
 /// <returns>A boolean indicating whether the principal has admin access.</returns>
 public virtual bool IsAdmin(IPrincipal user)
 {
     return(Administrators.Contains(user));
 }
示例#5
0
 /// <summary>
 /// Je skupina administrovaná členem?
 /// </summary>
 /// <param name="user">testovaný uživatel</param>
 /// <returns></returns>
 public bool IsAdminedBy(User user)
 {
     return(Administrators.Contains(user));
 }
示例#6
0
        public bool IsUserAdministrator(User u)
        {
            bool ad = Administrators.Contains(u);

            return(ad);
        }