Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2018-03-02 18:01:06 +0300
committerAndreas Brandl <abrandl@gitlab.com>2018-03-02 20:23:03 +0300
commit39011be53daee921dac1648044d1e68b9706197c (patch)
tree695cbcfa7346f2d4f8a4c566bd6f0ae31dd4f5c5 /app/finders/snippets_finder.rb
parent0a3fc7e3c283c10ef8415a719e83e80f0122af7d (diff)
Extract method User#authorizations_for_projects.
Diffstat (limited to 'app/finders/snippets_finder.rb')
-rw-r--r--app/finders/snippets_finder.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/app/finders/snippets_finder.rb b/app/finders/snippets_finder.rb
index 565955ffc05..d498a2d6d11 100644
--- a/app/finders/snippets_finder.rb
+++ b/app/finders/snippets_finder.rb
@@ -72,11 +72,7 @@ class SnippetsFinder < UnionFinder
# we can shortcut and just return.
return yield(Project.all) if current_user.full_private_access?
- authorized = current_user
- .project_authorizations
- .select(1)
- .where('project_authorizations.project_id = projects.id')
- authorized_projects = yield(Project.where('EXISTS (?)', authorized))
+ authorized_projects = yield(Project.where('EXISTS (?)', current_user.authorizations_for_projects))
levels = Gitlab::VisibilityLevel.levels_for_user(current_user)
visible_projects = yield(Project.where(visibility_level: levels))