summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-04-24 15:09:29 +0000
committerLin Jen-Shin <godfat@godfat.org>2017-05-04 23:13:38 +0800
commitfa2ec0c34255889406a610ba206ff1b897618153 (patch)
treec478344fe49e027bbaf614944c567c3626b1e625 /lib
parent0690531ec62cf08a2e596f2de87d224480e34422 (diff)
downloadgitlab-ce-fa2ec0c34255889406a610ba206ff1b897618153.tar.gz
Merge branch '31157-respect-project-features-in-wiki-search' into 'security'
Respect project features in wiki and blob search See merge request !2089
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/project_search_results.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/gitlab/project_search_results.rb b/lib/gitlab/project_search_results.rb
index db325c00705..a843a7322a6 100644
--- a/lib/gitlab/project_search_results.rb
+++ b/lib/gitlab/project_search_results.rb
@@ -82,6 +82,8 @@ module Gitlab
private
def blobs
+ return [] unless Ability.allowed?(@current_user, :download_code, @project)
+
@blobs ||= begin
blobs = project.repository.search_files_by_content(query, repository_ref).first(100)
found_file_names = Set.new
@@ -102,6 +104,8 @@ module Gitlab
end
def wiki_blobs
+ return [] unless Ability.allowed?(@current_user, :read_wiki, @project)
+
@wiki_blobs ||= begin
if project.wiki_enabled? && query.present?
project_wiki = ProjectWiki.new(project)