diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-19 00:06:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-19 00:06:37 +0300 |
commit | 4682f5015a5a2d7eedb66b3c90aee931d3789d0b (patch) | |
tree | 6240a8a5cf3584a893c6c3351141446e7856dc12 /app/models | |
parent | 6d59e989185a7d2645792b713d1b5d95d46651fd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index fe5c13f1c68..321a4080484 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -231,6 +231,10 @@ class User < ApplicationRecord # Note: When adding an option, it MUST go on the end of the array. enum project_view: [:readme, :activity, :files] + # User's role + # Note: When adding an option, it MUST go on the end of the array. + enum role: [:software_developer, :development_team_lead, :devops_engineer, :systems_administrator, :security_analyst, :data_analyst, :product_manager, :product_designer, :other], _suffix: true + delegate :path, to: :namespace, allow_nil: true, prefix: true delegate :notes_filter_for, to: :user_preference delegate :set_notes_filter, to: :user_preference @@ -1571,6 +1575,20 @@ class User < ApplicationRecord [last_activity, last_sign_in].compact.max end + # Below is used for the signup_flow experiment. Should be removed + # when experiment finishes. + # See https://gitlab.com/gitlab-org/growth/engineering/issues/64 + REQUIRES_ROLE_VALUE = 99 + + def role_required? + role_before_type_cast == REQUIRES_ROLE_VALUE + end + + def set_role_required! + update_column(:role, REQUIRES_ROLE_VALUE) + end + # End of signup_flow experiment methods + # @deprecated alias_method :owned_or_masters_groups, :owned_or_maintainers_groups |