private bool CheckPermission(IRoles roles, string permissionName, IAuthentication authentication) { var permissions = roles.GetPermissionsForCurrentUser().Select(r => r.Name).ToList(); if ((!authentication.IsAuthenticated || !permissions.Contains(permissionName)) && !roles.CurrentUserIsInRoles(RoleNames.Administrators)) { return(false); } return(true); }