public static bool hasPrivilege(string username, ElevationLevels minElevation, PrivilegeList priv = PrivilegeList.NONE) { if (staticIdentities == null) { reloadIdentities(); } if (username == String.Empty) { return(false); } FerrousIdentity id = staticIdentities.FirstOrDefault(m => m.username == username); if (id == null) { return(false); } if (id.elevation <= (int)minElevation) { return(true); } if (priv != PrivilegeList.NONE && id.privileges.Contains((int)priv)) { return(true); } return(false); }
public Authorization(ElevationLevels elevationLevel, PrivilegeList privilege) { _elevationLevel = elevationLevel; _privilege = privilege; }