summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/user.rb18
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