public bool ValidateUserPermissions() { string userRole = clientContextScraper.GetClientClaimsRole(); string controller = clientContextScraper.GetControllerName(); string action = clientContextScraper.GetActionrName(); if (string.IsNullOrWhiteSpace(userRole) || string.IsNullOrWhiteSpace(controller) || string.IsNullOrWhiteSpace(action)) { return(false); } return(GetPermissions() .Where(x => (x.RoleName == userRole || x.RoleName == UserRoleEnum.AllRoles.ToString()) && x.ControllerName == controller && (x.ActionName == action || x.AllowAllActions)) .Any()); }
public bool IsAdmin() { return(clientContextScraper.GetClientClaimsRole() == UserRoleEnum.Admin.ToString()); }