summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavin Walker <dwalker@gitlab.com>2018-03-20 18:41:59 +0000
committerDavin Walker <dwalker@gitlab.com>2018-03-20 18:41:59 +0000
commit792e3e44992599855c190c5f135bb8639e2e804c (patch)
tree377cb556206ee2c98bd0b1711b806a9de332b476
parent38bc4acb1c31d45937ecc318da06ac16faf234bb (diff)
downloadgitlab-ce-44460-api-group-visibility-level-incorrectly-evaluated.tar.gz
-rw-r--r--lib/api/groups.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index 4a4df1b8b9e..34d27a5a297 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -109,8 +109,11 @@ module API
else
authorize! :create_group
end
+
+ opts = declared_params(include_missing: false)
+ opts[:visibility_level] = Gitlab::VisibilityLevel.level_value opts[:visibility]
- group = ::Groups::CreateService.new(current_user, declared_params(include_missing: false)).execute
+ group = ::Groups::CreateService.new(current_user, opts).execute
if group.persisted?
present group, with: Entities::GroupDetail, current_user: current_user
@@ -135,8 +138,11 @@ module API
put ':id' do
group = find_group!(params[:id])
authorize! :admin_group, group
+
+ opts = declared_params(include_missing: false)
+ opts[:visibility_level] = Gitlab::VisibilityLevel.level_value opts[:visibility]
- if ::Groups::UpdateService.new(group, current_user, declared_params(include_missing: false)).execute
+ if ::Groups::UpdateService.new(group, current_user, opts).execute
present group, with: Entities::GroupDetail, current_user: current_user
else
render_validation_error!(group)