summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-04-24 15:09:29 +0000
committerBob Van Landuyt <bob@gitlab.com>2017-05-10 16:44:20 +0200
commit61a81a3ac225296f8aefc4d2f350de72a531bf3d (patch)
tree5222aa976e732c27607425282193181f9efed3a3 /lib
parentd9ec830a8348fca93775c5f0b1f81a83e8c4f95a (diff)
downloadgitlab-ce-61a81a3ac225296f8aefc4d2f350de72a531bf3d.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 0b8959f2fb9..47cfe412715 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)