2012-03-15 23:14:39 +00:00
|
|
|
class SearchController < ApplicationController
|
|
|
|
def show
|
2014-01-09 10:37:12 +00:00
|
|
|
@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)
|
2014-01-16 17:03:42 +00:00
|
|
|
@search_results = Search::ProjectService.new(@project, current_user, params).execute
|
2014-01-09 10:37:12 +00:00
|
|
|
else
|
2014-01-16 17:03:42 +00:00
|
|
|
@search_results = Search::GlobalService.new(current_user, params).execute
|
2013-10-23 20:27:40 +00:00
|
|
|
end
|
|
|
|
end
|
2012-03-15 23:14:39 +00:00
|
|
|
end
|