Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-16 12:07:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-16 12:07:51 +0300
commit914ea32e0efca21436220df2c10e1bfbe4ed3da9 (patch)
treee8eb3b97aea2006bd863c586b7ec41d51f654b3b /app/services/groups
parent3546e1bb0971347e9e9984de0799e3fb53743b33 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/groups')
-rw-r--r--app/services/groups/transfer_service.rb8
-rw-r--r--app/services/groups/update_service.rb16
2 files changed, 23 insertions, 1 deletions
diff --git a/app/services/groups/transfer_service.rb b/app/services/groups/transfer_service.rb
index fe7e07ef9f0..6902b7bd529 100644
--- a/app/services/groups/transfer_service.rb
+++ b/app/services/groups/transfer_service.rb
@@ -7,7 +7,8 @@ module Groups
namespace_with_same_path: s_('TransferGroup|The parent group already has a subgroup with the same path.'),
group_is_already_root: s_('TransferGroup|Group is already a root group.'),
same_parent_as_current: s_('TransferGroup|Group is already associated to the parent group.'),
- invalid_policies: s_("TransferGroup|You don't have enough permissions.")
+ invalid_policies: s_("TransferGroup|You don't have enough permissions."),
+ group_contains_images: s_('TransferGroup|Cannot update the path because there are projects under this group that contain Docker images in their Container Registry. Please remove the images from your projects first and try again.')
}.freeze
TransferError = Class.new(StandardError)
@@ -46,6 +47,7 @@ module Groups
raise_transfer_error(:same_parent_as_current) if same_parent?
raise_transfer_error(:invalid_policies) unless valid_policies?
raise_transfer_error(:namespace_with_same_path) if namespace_with_same_path?
+ raise_transfer_error(:group_contains_images) if group_projects_contain_registry_images?
end
def group_is_already_root?
@@ -72,6 +74,10 @@ module Groups
end
# rubocop: enable CodeReuse/ActiveRecord
+ def group_projects_contain_registry_images?
+ @group.has_container_repositories?
+ end
+
def update_group_attributes
if @new_parent_group && @new_parent_group.visibility_level < @group.visibility_level
update_children_and_projects_visibility
diff --git a/app/services/groups/update_service.rb b/app/services/groups/update_service.rb
index 534de601e20..be7502a193e 100644
--- a/app/services/groups/update_service.rb
+++ b/app/services/groups/update_service.rb
@@ -8,6 +8,11 @@ module Groups
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?
@@ -35,6 +40,17 @@ module Groups
# overridden in EE
end
+ def renaming_group_with_container_registry_images?
+ new_path = params[:path]
+
+ new_path && new_path != group.path &&
+ group.has_container_repositories?
+ end
+
+ def container_images_error
+ s_("GroupSettings|Cannot update the path because there are projects under this group that contain Docker images in their Container Registry. Please remove the images from your projects first and try again.")
+ end
+
def after_update
if group.previous_changes.include?(:visibility_level) && group.private?
# don't enqueue immediately to prevent todos removal in case of a mistake