2017-10-11 10:47:08 -04:00
|
|
|
module Members
|
|
|
|
class UpdateService < Members::BaseService
|
|
|
|
# returns the updated member
|
|
|
|
def execute(member, permission: :update)
|
2018-02-16 09:10:22 -05:00
|
|
|
raise Gitlab::Access::AccessDeniedError unless can?(current_user, action_member_permission(permission, member), member)
|
2017-10-11 10:47:08 -04:00
|
|
|
|
|
|
|
old_access_level = member.human_access
|
|
|
|
|
|
|
|
if member.update_attributes(params)
|
|
|
|
after_execute(action: permission, old_access_level: old_access_level, member: member)
|
|
|
|
end
|
|
|
|
|
|
|
|
member
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|