Class: NamespaceSettings::UpdateService
- Inherits:
-
Object
- Object
- NamespaceSettings::UpdateService
- Includes:
- Gitlab::Allowable
- Defined in:
- app/services/namespace_settings/update_service.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#settings_params ⇒ Object
readonly
Returns the value of attribute settings_params.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user, group, settings) ⇒ UpdateService
constructor
A new instance of UpdateService.
Methods included from Gitlab::Allowable
Constructor Details
#initialize(current_user, group, settings) ⇒ UpdateService
Returns a new instance of UpdateService.
9 10 11 12 13 |
# File 'app/services/namespace_settings/update_service.rb', line 9 def initialize(current_user, group, settings) @current_user = current_user @group = group @settings_params = settings end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
7 8 9 |
# File 'app/services/namespace_settings/update_service.rb', line 7 def current_user @current_user end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
7 8 9 |
# File 'app/services/namespace_settings/update_service.rb', line 7 def group @group end |
#settings_params ⇒ Object (readonly)
Returns the value of attribute settings_params.
7 8 9 |
# File 'app/services/namespace_settings/update_service.rb', line 7 def settings_params @settings_params end |
Instance Method Details
#execute ⇒ Object
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 |
# File 'app/services/namespace_settings/update_service.rb', line 15 def execute validate_resource_access_token_creation_allowed_param validate_settings_param_for_root_group( param_key: :prevent_sharing_groups_outside_hierarchy, user_policy: :change_prevent_sharing_groups_outside_hierarchy ) validate_settings_param_for_root_group( param_key: :new_user_signups_cap, user_policy: :change_new_user_signups_cap ) validate_settings_param_for_root_group( param_key: :default_branch_protection, user_policy: :update_default_branch_protection ) validate_settings_param_for_root_group( param_key: :default_branch_protection_defaults, user_policy: :update_default_branch_protection ) handle_default_branch_protection unless settings_params[:default_branch_protection].blank? if group.namespace_settings group.namespace_settings.attributes = settings_params else group.build_namespace_settings(settings_params) end end |