gitlab-org--gitlab-foss/app/controllers/search_controller.rb
Dmitriy Zaporozhets b49ebf5737
Use new context for search
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-01-09 12:37:12 +02:00

13 lines
519 B
Ruby

class SearchController < ApplicationController
def show
@project = Project.find_by_id(params[:project_id]) if params[:project_id].present?
@group = Group.find_by_id(params[:group_id]) if params[:group_id].present?
if @project
return access_denied! unless can?(current_user, :download_code, @project)
@search_results = Search::ProjectContext.new(@project, current_user, params).execute
else
@search_results = Search::GlobalContext.new(current_user, params).execute
end
end
end