summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-05-08 15:07:55 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-05-10 17:02:27 +0200
commitf7f13f9db0da92c7b43481dfe5559f317711e533 (patch)
tree59359aecb555f844de1a81a0aebbd70336fbb8c1 /app/models/user.rb
parentf667bbceaba7556d5fb2adadce4b7d170b914e8a (diff)
downloadgitlab-ce-f7f13f9db0da92c7b43481dfe5559f317711e533.tar.gz
Block access to API & git when terms are enforced
When terms are enforced, but the user has not accepted the terms access to the API & git is rejected with a message directing the user to the web app to accept the terms.
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index a9cfd39f604..884f3bbb364 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1193,6 +1193,11 @@ class User < ActiveRecord::Base
accepted_term_id.present?
end
+ def required_terms_not_accepted?
+ Gitlab::CurrentSettings.current_application_settings.enforce_terms? &&
+ !terms_accepted?
+ end
+
protected
# override, from Devise::Validatable