gitlab-org--gitlab-foss/app/services/groups/update_service.rb

21 lines
579 B
Ruby
Raw Normal View History

#Checks visibility level permission check before updating a group
#Do not allow to put Group visibility level smaller than its projects
#Do not allow unauthorized permission levels
module Groups
class UpdateService < Groups::BaseService
def execute
return false unless visibility_level_allowed?(params[:visibility_level])
group.update_attributes(params)
end
private
def visibility_level_allowed?(level)
return true unless level.present?
2016-03-17 18:42:46 -04:00
visibility_allowed_for_project?(level) && visibility_allowed_for_user?(level)
end
end
end