示例#1
0
 //checks if a user is signed in
 public static bool IsSignedIn(ISession session)
 {
     return(AuthenticationHandler.CurrentUser(session).RoleID != 0);
 }
示例#2
0
 //checks if current user meets authorization requirements
 public static bool IsAuthorized(User user, ValidRole role)
 {
     return(AuthenticationHandler.GetDatabaseInstance(user).RoleID == (int)role);
 }
示例#3
0
 //checks if current user meets authorization requirements
 public static bool IsAuthorized(User user, string role)
 {
     return(AuthenticationHandler.GetDatabaseInstance(user).Role.RoleName == role);
 }