diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-07-20 20:35:11 +0000 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-07-20 20:35:11 +0000 |
commit | 9de377267dc7ea9b72e02e6dc5a083cdc3ee980b (patch) | |
tree | 286f94d0b7192f959f3896aa8dd65b7b120a722c /app/models/user.rb | |
parent | 22c8e21bf432a68f05bd81685d76acc0a3c9607f (diff) | |
parent | ea63346df5a420cebbc44491eef8e2d2a0fb5ad7 (diff) | |
download | gitlab-ce-9de377267dc7ea9b72e02e6dc5a083cdc3ee980b.tar.gz |
Merge branch '18586-user-authorized_projects-is-slow' into 'master'
Refactor user authorization check for a single project to avoid querying all user projects
See merge request !5102
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 7cbd97c0069..db747434959 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -412,6 +412,8 @@ class User < ActiveRecord::Base end # Returns projects user is authorized to access. + # + # If you change the logic of this method, please also update `Project#authorized_for_user` def authorized_projects(min_access_level = nil) Project.where("projects.id IN (#{projects_union(min_access_level).to_sql})") end |