summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/issues_controller.rb2
-rw-r--r--test/integration/api_test/issues_test.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 161022635..15f26e273 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -133,7 +133,7 @@ class IssuesController < ApplicationController
end
def create
- unless User.current.allowed_to?(:add_issues, @issue.project)
+ unless User.current.allowed_to?(:add_issues, @issue.project, :global => true)
raise ::Unauthorized
end
call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb
index bad182236..08543ab15 100644
--- a/test/integration/api_test/issues_test.rb
+++ b/test/integration/api_test/issues_test.rb
@@ -444,6 +444,11 @@ JSON
assert json['errors'].include?("Subject cannot be blank")
end
+ test "POST /issues.json with invalid project_id should respond with 422" do
+ post '/issues.json', {:issue => {:project_id => 999, :subject => "API"}}, credentials('jsmith')
+ assert_response 422
+ end
+
test "PUT /issues/:id.xml" do
assert_difference('Journal.count') do
put '/issues/6.xml',