Class: Groups::UpdateService

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

Constant Summary collapse

SETTINGS_PARAMS =
[:allow_mfa_for_subgroups].freeze

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



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
38
39
40
41
42
43
44
45
# File 'app/services/groups/update_service.rb', line 9

def execute
  reject_parent_id!
  remove_unallowed_params

  before_assignment_hook(group, 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, group.visibility_attribute_value(params))

  return false unless valid_share_with_group_lock_change?

  return false unless valid_path_change?

  return false unless update_shared_runners

  handle_changes

  handle_namespace_settings

  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