Пример #1
0
 public static bool HasRole(this ControllerBase controller, string role)
 {
     bool bFound = false;
     try
     {
         //Check if the requesting user has the specified role...
         bFound = new RBAC(controller.ControllerContext.HttpContext.User.Identity.GetUserId<int>()).HasRole(role);
     }
     catch { }
     return bFound;
 }
Пример #2
0
 public static bool IsCustomer(this ControllerBase controller)
 {
     bool bFound = false;
     try
     {
         //Check if the requesting user has the specified application permission...
         bFound = new RBAC(controller.ControllerContext.HttpContext.User.Identity.GetUserId<int>()).IsCustomer();
     }
     catch
     {
     }
     return bFound;
 }