diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /app/services/groups/update_service.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/services/groups/update_service.rb')
-rw-r--r-- | app/services/groups/update_service.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/services/groups/update_service.rb b/app/services/groups/update_service.rb index 948540619ae..81393681dc0 100644 --- a/app/services/groups/update_service.rb +++ b/app/services/groups/update_service.rb @@ -17,6 +17,8 @@ module Groups 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) @@ -36,6 +38,20 @@ module Groups private + def valid_path_change_with_npm_packages? + return true unless group.packages_feature_enabled? + return true if params[:path].blank? + return true if !group.has_parent? && group.path == params[:path] + + npm_packages = ::Packages::GroupPackagesFinder.new(current_user, group, package_type: :npm).execute + if npm_packages.exists? + group.errors.add(:path, s_('GroupSettings|cannot change when group contains projects with NPM packages')) + return + end + + true + end + def before_assignment_hook(group, params) # overridden in EE end |