Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-04-27 17:50:33 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2018-05-04 14:54:43 +0300
commit7684217d6806408cd338260119364419260d1720 (patch)
tree7b913d6c6c051a463d99ad286e2ac04a6b8d5632 /app/policies
parent10aa55a770c2985c22c92d17b8a7ea90b0a09085 (diff)
Enforces terms in the web application
This enforces the terms in the web application. These cases are specced: - Logging in: When terms are enforced, and a user logs in that has not accepted the terms, they are presented with the screen. They get directed to their customized root path afterwards. - Signing up: After signing up, the first screen the user is presented with the screen to accept the terms. After they accept they are directed to the dashboard. - While a session is active: - For a GET: The user will be directed to the terms page first, after they accept the terms, they will be directed to the page they were going to - For any other request: They are directed to the terms, after they accept the terms, they are directed back to the page they came from to retry the request. Any information entered would be persisted in localstorage and available on the page.
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/application_setting/term_policy.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/app/policies/application_setting/term_policy.rb b/app/policies/application_setting/term_policy.rb
index 648932ddba9..f03bf748c76 100644
--- a/app/policies/application_setting/term_policy.rb
+++ b/app/policies/application_setting/term_policy.rb
@@ -2,17 +2,15 @@ class ApplicationSetting
class TermPolicy < BasePolicy
include Gitlab::Utils::StrongMemoize
- condition(:logged_in, scope: :user) { @user }
-
condition(:current_terms, scope: :subject) do
Gitlab::CurrentSettings.current_application_settings.latest_terms == @subject
end
- condition(:terms_accepted, scope: :user, score: 1) do
+ condition(:terms_accepted, score: 1) do
agreement&.accepted
end
- rule { logged_in & current_terms }.policy do
+ rule { ~anonymous & current_terms }.policy do
enable :accept_terms
enable :decline_terms
end