Class: Groups::UpdateService

Inherits:
BaseService show all
Includes:
UpdateVisibilityLevel
Defined in:
app/services/groups/update_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #group, #params

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from UpdateVisibilityLevel

#valid_visibility_level_change?

Methods inherited from BaseService

#initialize

Methods inherited from BaseService

#initialize

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?

Constructor Details

This class inherits a constructor from Groups::BaseService

Instance Method Details

#executeObject


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/services/groups/update_service.rb', line 7

def execute
  reject_parent_id!
  remove_unallowed_params

  if renaming_group_with_container_registry_images?
    group.errors.add(:base, container_images_error)
    return false
  end

  return false unless valid_visibility_level_change?(group, params[:visibility_level])

  return false unless valid_share_with_group_lock_change?

  return false unless valid_path_change_with_npm_packages?

  before_assignment_hook(group, params)

  group.assign_attributes(params)

  begin
    success = group.save

    after_update if success

    success
  rescue Gitlab::UpdatePathError => e
    group.errors.add(:base, e.message)

    false
  end
end