diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /app/models/namespace_setting.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'app/models/namespace_setting.rb')
-rw-r--r-- | app/models/namespace_setting.rb | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/app/models/namespace_setting.rb b/app/models/namespace_setting.rb index 170b29e9e21..ef917c8a22e 100644 --- a/app/models/namespace_setting.rb +++ b/app/models/namespace_setting.rb @@ -3,6 +3,7 @@ class NamespaceSetting < ApplicationRecord include CascadingNamespaceSettingAttribute include Sanitizable + include ChronicDurationAttribute cascading_attr :delayed_project_removal @@ -12,17 +13,19 @@ class NamespaceSetting < ApplicationRecord validate :allow_mfa_for_group validate :allow_resource_access_token_creation_for_group - before_save :set_prevent_sharing_groups_outside_hierarchy, if: -> { user_cap_enabled? } - after_save :disable_project_sharing!, if: -> { user_cap_enabled? } - before_validation :normalize_default_branch_name enum jobs_to_be_done: { basics: 0, move_repository: 1, code_storage: 2, exploring: 3, ci: 4, other: 5 }, _suffix: true + chronic_duration_attr :runner_token_expiration_interval_human_readable, :runner_token_expiration_interval + chronic_duration_attr :subgroup_runner_token_expiration_interval_human_readable, :subgroup_runner_token_expiration_interval + chronic_duration_attr :project_runner_token_expiration_interval_human_readable, :project_runner_token_expiration_interval + NAMESPACE_SETTINGS_PARAMS = [:default_branch_name, :delayed_project_removal, :lock_delayed_project_removal, :resource_access_token_creation_allowed, :prevent_sharing_groups_outside_hierarchy, :new_user_signups_cap, - :setup_for_company, :jobs_to_be_done].freeze + :setup_for_company, :jobs_to_be_done, :runner_token_expiration_interval, + :subgroup_runner_token_expiration_interval, :project_runner_token_expiration_interval].freeze self.primary_key = :namespace_id @@ -59,18 +62,6 @@ class NamespaceSetting < ApplicationRecord errors.add(:resource_access_token_creation_allowed, _('is not allowed since the group is not top-level group.')) end end - - def set_prevent_sharing_groups_outside_hierarchy - self.prevent_sharing_groups_outside_hierarchy = true - end - - def disable_project_sharing! - namespace.update_attribute(:share_with_group_lock, true) - end - - def user_cap_enabled? - new_user_signups_cap.present? && namespace.root? - end end NamespaceSetting.prepend_mod_with('NamespaceSetting') |