summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-31 11:45:01 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-31 11:45:27 +0000
commit185d6a2578f64ffafd80bea5314915811a54486a (patch)
tree90d435f1c353da19b799046f66aa7abbf1bd778d /lib
parent4530f5d0bdc9b2f60eed2146eaf1b6f35fc53b0e (diff)
downloadgitlab-ce-185d6a2578f64ffafd80bea5314915811a54486a.tar.gz
Add latest changes from gitlab-org/security/gitlab@13-12-stable-ee
Diffstat (limited to 'lib')
-rw-r--r--lib/api/lint.rb2
-rw-r--r--lib/gitlab/current_settings.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/api/lint.rb b/lib/api/lint.rb
index e0806674c6a..945cdf3edb2 100644
--- a/lib/api/lint.rb
+++ b/lib/api/lint.rb
@@ -11,7 +11,7 @@ module API
optional :include_merged_yaml, type: Boolean, desc: 'Whether or not to include merged CI config yaml in the response'
end
post '/lint' do
- unauthorized! if Gitlab::CurrentSettings.signup_disabled? && current_user.nil?
+ unauthorized! if (Gitlab::CurrentSettings.signup_disabled? || Gitlab::CurrentSettings.signup_limited?) && current_user.nil?
result = Gitlab::Ci::YamlProcessor.new(params[:content], user: current_user).execute
diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb
index 7f55734f796..e7ffeeb9849 100644
--- a/lib/gitlab/current_settings.rb
+++ b/lib/gitlab/current_settings.rb
@@ -7,6 +7,10 @@ module Gitlab
!signup_enabled?
end
+ def signup_limited?
+ domain_allowlist.present? || email_restrictions_enabled? || require_admin_approval_after_user_signup?
+ end
+
def current_application_settings
Gitlab::SafeRequestStore.fetch(:current_application_settings) { ensure_application_settings! }
end