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:
authorJason Hollingsworth <jhworth.developer@gmail.com>2014-02-14 00:45:51 +0400
committerJason Hollingsworth <jhworth.developer@gmail.com>2014-02-20 19:26:38 +0400
commit2f69213e3f32e2e4222f6335e790e2c778069014 (patch)
tree3734a9d41d2445a1557ed2f79c6cfa3de7dec215 /app/services/search
parent138e2a50b7d839bd37c21b2849df422f9dfef6bb (diff)
Allow access to groups with public projects.
Fixed Group avatars to only display when user has read permissions to at least one project in the group.
Diffstat (limited to 'app/services/search')
-rw-r--r--app/services/search/global_service.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/app/services/search/global_service.rb b/app/services/search/global_service.rb
index c1130401578..09c7cb25dd5 100644
--- a/app/services/search/global_service.rb
+++ b/app/services/search/global_service.rb
@@ -11,12 +11,8 @@ module Search
query = Shellwords.shellescape(query) if query.present?
return result unless query.present?
- authorized_projects_ids = []
- authorized_projects_ids += current_user.authorized_projects.pluck(:id) if current_user
- authorized_projects_ids += Project.public_or_internal_only(current_user).pluck(:id)
-
group = Group.find_by(id: params[:group_id]) if params[:group_id].present?
- projects = Project.where(id: authorized_projects_ids)
+ projects = Project.accessible_to(current_user)
projects = projects.where(namespace_id: group.id) if group
projects = projects.search(query)
project_ids = projects.pluck(:id)