summaryrefslogtreecommitdiff
path: root/app/models/project_authorization.rb
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2016-10-11 14:25:17 +0200
committerAhmad Sherif <me@ahmadsherif.com>2016-11-18 20:25:45 +0200
commitfd05e26618dd0c123ca476b6f5a3d85f1cfe397a (patch)
tree39a4ac60382ca7ce8d46e3745ba8a381580d6314 /app/models/project_authorization.rb
parentaea8baed3093c513560e9ac5ac0c5c99508d3001 (diff)
downloadgitlab-ce-fd05e26618dd0c123ca476b6f5a3d85f1cfe397a.tar.gz
Precalculate user's authorized projects in database
Closes #23150
Diffstat (limited to 'app/models/project_authorization.rb')
-rw-r--r--app/models/project_authorization.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/project_authorization.rb b/app/models/project_authorization.rb
new file mode 100644
index 00000000000..a00d43773d9
--- /dev/null
+++ b/app/models/project_authorization.rb
@@ -0,0 +1,8 @@
+class ProjectAuthorization < ActiveRecord::Base
+ belongs_to :user
+ belongs_to :project
+
+ validates :project, presence: true
+ validates :access_level, inclusion: { in: Gitlab::Access.all_values }, presence: true
+ validates :user, uniqueness: { scope: [:project, :access_level] }, presence: true
+end