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; }
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; }