summaryrefslogtreecommitdiffstats
path: root/app/controllers/queries_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/queries_controller.rb')
-rw-r--r--app/controllers/queries_controller.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb
index 194b1df57..da2c4a2c8 100644
--- a/app/controllers/queries_controller.rb
+++ b/app/controllers/queries_controller.rb
@@ -19,7 +19,7 @@ class QueriesController < ApplicationController
layout 'base'
menu_item :issues
before_filter :find_query, :except => :new
- before_filter :find_project, :authorize, :only => :new
+ before_filter :find_optional_project, :only => :new
def new
@query = Query.new(params[:query])
@@ -72,8 +72,9 @@ private
render_404
end
- def find_project
- @project = Project.find(params[:project_id])
+ def find_optional_project
+ @project = Project.find(params[:project_id]) if params[:project_id]
+ User.current.allowed_to?(:save_queries, @project, :global => true)
rescue ActiveRecord::RecordNotFound
render_404
end