summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-04 10:03:30 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-04 10:03:30 +0000
commitd35df0ad158c14cb28f583f4b26c4196ef23a3f7 (patch)
tree5a1992758772519104eacb5de2c231721876541c /lib
parent3c51da6f5782e53123a7ed5af98ba0828cbfa49f (diff)
downloadgitlab-ce-d35df0ad158c14cb28f583f4b26c4196ef23a3f7.tar.gz
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'lib')
-rw-r--r--lib/api/terraform/state.rb2
-rw-r--r--lib/gitlab/visibility_level.rb12
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/api/terraform/state.rb b/lib/api/terraform/state.rb
index 052c75188ab..5141d1fd499 100644
--- a/lib/api/terraform/state.rb
+++ b/lib/api/terraform/state.rb
@@ -46,7 +46,7 @@ module API
desc 'Add a new terraform state or update an existing one'
route_setting :authentication, basic_auth_personal_access_token: true
post do
- data = request.body.string
+ data = request.body.read
no_content! if data.empty?
remote_state_handler.handle_with_lock do |state|
diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb
index 082d93aa354..a22740ab9b7 100644
--- a/lib/gitlab/visibility_level.rb
+++ b/lib/gitlab/visibility_level.rb
@@ -82,15 +82,23 @@ module Gitlab
end
def non_restricted_level?(level)
+ !restricted_level?(level)
+ end
+
+ def restricted_level?(level)
restricted_levels = Gitlab::CurrentSettings.restricted_visibility_levels
if restricted_levels.nil?
- true
+ false
else
- !restricted_levels.include?(level)
+ restricted_levels.include?(level)
end
end
+ def public_visibility_restricted?
+ restricted_level?(PUBLIC)
+ end
+
def valid_level?(level)
options.value?(level)
end