summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2019-02-25 15:17:17 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2019-03-04 17:44:56 +0100
commit88abe1ec55cfa669c6ccebd27999600f1947aee1 (patch)
treefb6047ea04491a046bfc569141b6000dc2dfb251 /lib/api
parent890ffac61bca34172613b6a1d54bbd436859f276 (diff)
downloadgitlab-ce-88abe1ec55cfa669c6ccebd27999600f1947aee1.tar.gz
Use a method for updating groups in the API
Similar to creating groups in the groups API, EE injects custom code just before we update an existing group. Moving the update logic to a separate method in CE allows EE to more easily extend it.
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/groups.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index a414b9b326d..cb0d6d96f29 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -66,6 +66,14 @@ module API
.execute
end
+ def update_group(group)
+ # This is a separate method so that EE can extend its behaviour, without
+ # having to modify this code directly.
+ ::Groups::UpdateService
+ .new(group, current_user, declared_params(include_missing: false))
+ .execute
+ end
+
def find_group_projects(params)
group = find_group!(params[:id])
options = {
@@ -161,7 +169,7 @@ module API
group = find_group!(params[:id])
authorize! :admin_group, group
- if ::Groups::UpdateService.new(group, current_user, declared_params(include_missing: false)).execute
+ if update_group(group)
present group, with: Entities::GroupDetail, current_user: current_user
else
render_validation_error!(group)