Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
faef0d1c
Commit
faef0d1c
authored
Sep 12, 2019
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add role enum to user
parent
92c346f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
0 deletions
+38
-0
app/models/user.rb
app/models/user.rb
+4
-0
db/migrate/20190912223232_add_role_to_users.rb
db/migrate/20190912223232_add_role_to_users.rb
+33
-0
db/schema.rb
db/schema.rb
+1
-0
No files found.
app/models/user.rb
View file @
faef0d1c
...
...
@@ -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 Project preference
# 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
]
delegate
:path
,
to: :namespace
,
allow_nil:
true
,
prefix:
true
delegate
:notes_filter_for
,
to: :user_preference
delegate
:set_notes_filter
,
to: :user_preference
...
...
db/migrate/20190912223232_add_role_to_users.rb
0 → 100644
View file @
faef0d1c
# frozen_string_literal: true
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
AddRoleToUsers
<
ActiveRecord
::
Migration
[
5.2
]
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
# When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the
# migration requires downtime.
# DOWNTIME_REASON = ''
# When using the methods "add_concurrent_index", "remove_concurrent_index" or
# "add_column_with_default" you must disable the use of transactions
# as these methods can not run in an existing transaction.
# When using "add_concurrent_index" or "remove_concurrent_index" methods make sure
# that either of them is the _only_ method called in the migration,
# any other changes should go in a separate migration.
# This ensures that upon failure _only_ the index creation or removing fails
# and can be retried or reverted easily.
#
# To disable transactions uncomment the following line and remove these
# comments:
# disable_ddl_transaction!
def
change
add_column
:users
,
:role
,
:integer
end
end
db/schema.rb
View file @
faef0d1c
...
...
@@ -3722,6 +3722,7 @@ ActiveRecord::Schema.define(version: 2019_10_16_072826) do
t
.
string
"first_name"
,
limit:
255
t
.
string
"last_name"
,
limit:
255
t
.
string
"static_object_token"
,
limit:
255
t
.
integer
"role"
t
.
index
"lower((name)::text)"
,
name:
"index_on_users_name_lower"
t
.
index
[
"accepted_term_id"
],
name:
"index_users_on_accepted_term_id"
t
.
index
[
"admin"
],
name:
"index_users_on_admin"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment