Skip to content
Snippets Groups Projects

CE upstream

Merged Valery Sizov requested to merge ce_upstream into master
2 files
+ 46
0
Compare changes
  • Side-by-side
  • Inline
Files
2
  • This method can be used to retrieve a list of projects for a user that
    said user has reporter access to. This list is then be reduced down to
    a specific set of projects. This allows you to reduce a list of projects
    to a list of projects you have reporter access to in an efficient
    manner.
+ 10
0
@@ -444,6 +444,16 @@ def authorized_projects(min_access_level = nil)
Project.where("projects.id IN (#{projects_union(min_access_level).to_sql})")
end
# Returns the projects this user has reporter (or greater) access to, limited
# to at most the given projects.
#
# This method is useful when you have a list of projects and want to
# efficiently check to which of these projects the user has at least reporter
# access.
def projects_with_reporter_access_limited_to(projects)
authorized_projects(Gitlab::Access::REPORTER).where(id: projects)
end
def viewable_starred_projects
starred_projects.where("projects.visibility_level IN (?) OR projects.id IN (#{projects_union.to_sql})",
[Project::PUBLIC, Project::INTERNAL])
Loading