예제 #1
0
        private bool IsAuthorizedToModifyRoleAssignment(RoleAssignment roleAssignment)
        {
            var departmentId = DbContext.Roles
                .Find(roleAssignment.RoleId)
                .Name.GetLast(4);

            if (HttpContext.Current.User.IsInRole("manage-all") ||
                HttpContext.Current.User.IsInRole("manage-users-" + departmentId))
            {
                return true;
            }

            return false;
        }
예제 #2
0
        private bool IsAuthorizedToDeleteRoleAssignment(RoleAssignment roleAssignment)
        {
            if (IsAuthorizedToModifyRoleAssignment(roleAssignment))
            {
                return true;
            }

            return false;
        }