diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-04-24 18:09:29 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2017-05-10 12:08:43 +0300 |
commit | dc54c570efa105df9e59da5dd974496273637811 (patch) | |
tree | 4a0b538c78c8b4fa564fe25d528dfb5f83219baa /lib | |
parent | 6a80267e074eb5d9753d7cdee7a1902b9ffdf355 (diff) |
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.rb | 4 |
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) |