diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-27 15:56:50 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-05-04 14:54:43 +0300 |
commit | 10aa55a770c2985c22c92d17b8a7ea90b0a09085 (patch) | |
tree | 15b66bb5e3f26d0a49c07bf781c644deb998f0c8 /app/helpers | |
parent | 65bea3f7d0bf30b5f9a9b3f94567474d3c8f7cbc (diff) |
Allow a user to accept/decline terms
When a user accepts, we store this in the agreements to keep track of
which terms they accepted. We also update the flag on the user.
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/users_helper.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 517268175e6..e803cd3a8d8 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -38,13 +38,24 @@ module UsersHelper end def get_current_user_menu_items - items = [:help, :sign_out] + items = [] - if can?(current_user, :read_user, current_user) + items << :sign_out if current_user + + # TODO: Remove these conditions when the permissions are prevented in + # https://gitlab.com/gitlab-org/gitlab-ce/issues/45849 + terms_not_enforced = !Gitlab::CurrentSettings + .current_application_settings + .enforce_terms? + required_terms_accepted = terms_not_enforced || current_user.terms_accepted? + + items << :help if required_terms_accepted + + if can?(current_user, :read_user, current_user) && required_terms_accepted items << :profile end - if can?(current_user, :update_user, current_user) + if can?(current_user, :update_user, current_user) && required_terms_accepted items << :settings end |