summaryrefslogtreecommitdiff
path: root/app/services/groups
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2017-09-01 23:59:24 -0700
committerMichael Kozono <mkozono@gmail.com>2017-09-06 12:07:20 -0700
commit9fc10b1bf33ddede32a4a8e0217144383831cee6 (patch)
tree07bbbb4624cbb855af07f0fe044d68447587135f /app/services/groups
parentc2c6c4c69e40bca205d3c442cd7e2ce00383fb10 (diff)
downloadgitlab-ce-9fc10b1bf33ddede32a4a8e0217144383831cee6.tar.gz
Dry up method for code climate
Diffstat (limited to 'app/services/groups')
-rw-r--r--app/services/groups/update_service.rb13
1 files changed, 3 insertions, 10 deletions
diff --git a/app/services/groups/update_service.rb b/app/services/groups/update_service.rb
index 45716c63cfc..90da1b3d1fe 100644
--- a/app/services/groups/update_service.rb
+++ b/app/services/groups/update_service.rb
@@ -1,18 +1,11 @@
module Groups
class UpdateService < Groups::BaseService
+ include UpdateVisibilityLevel
+
def execute
reject_parent_id!
- # check that user is allowed to set specified visibility_level
- new_visibility = params[:visibility_level]
- if new_visibility && new_visibility.to_i != group.visibility_level
- unless can?(current_user, :change_visibility_level, group) &&
- Gitlab::VisibilityLevel.allowed_for?(current_user, new_visibility)
-
- deny_visibility_level(group, new_visibility)
- return false
- end
- end
+ return false unless visibility_level_allowed?(group, params[:visibility_level])
return false unless valid_share_with_group_lock_change?