diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2016-10-11 14:25:17 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2016-11-18 20:25:45 +0200 |
commit | fd05e26618dd0c123ca476b6f5a3d85f1cfe397a (patch) | |
tree | 39a4ac60382ca7ce8d46e3745ba8a381580d6314 /app/models/project_authorization.rb | |
parent | aea8baed3093c513560e9ac5ac0c5c99508d3001 (diff) | |
download | gitlab-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.rb | 8 |
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 |