Class: Organizations::OrganizationUsers::UpdateService

Inherits:
Object
  • Object
show all
Includes:
BaseServiceUtility
Defined in:
app/services/organizations/organization_users/update_service.rb

Instance Method Summary collapse

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?, #can_all?, #can_any?

Constructor Details

#initialize(organization_user, current_user:, params: {}) ⇒ UpdateService



8
9
10
11
12
# File 'app/services/organizations/organization_users/update_service.rb', line 8

def initialize(organization_user, current_user:, params: {})
  @organization_user = organization_user
  @current_user = current_user
  @params = params.dup
end

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
22
# File 'app/services/organizations/organization_users/update_service.rb', line 14

def execute
  return error_response unless allowed?

  if organization_user.update(params)
    ServiceResponse.success(payload: { organization_user: organization_user })
  else
    error_updating
  end
end