GRN2-309: Allows admins to edit a non-local users name and email (#2389)

* Allows admins to edit a non-local users name and email

* Fixed edge case
This commit is contained in:
Ahmad Farhat
2020-12-24 13:21:56 -05:00
committed by GitHub
parent 86e6056d3c
commit b2500e6504
4 changed files with 30 additions and 4 deletions

View File

@ -194,6 +194,14 @@ class ApplicationController < ActionController::Base
end
helper_method :allowed_file_types
# Allows admins to edit a user's details
def can_edit_user?(user_to_edit, editting_user)
return user_to_edit.greenlight_account? if user_to_edit == editting_user
editting_user.admin_of?(user_to_edit, "can_manage_users")
end
helper_method :can_edit_user?
# Returns the page that the logo redirects to when clicked on
def home_page
return admins_path if current_user.has_role? :super_admin