Merged r15740 and r15748 (#23410).

git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@15768 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2016-08-31 16:54:24 +00:00
parent d20f2a7def
commit e9370c3fce
4 changed files with 23 additions and 0 deletions

View File

@@ -489,6 +489,9 @@ class IssuesController < ApplicationController
render_error l(:error_no_default_issue_status) render_error l(:error_no_default_issue_status)
return false return false
end end
elsif request.get?
render_error :message => l(:error_no_projects_with_tracker_allowed_for_new_issue), :status => 403
return false
end end
@priorities = IssuePriority.active @priorities = IssuePriority.active

View File

@@ -214,6 +214,7 @@ en:
error_attachment_extension_not_allowed: "Attachment extension %{extension} is not allowed" error_attachment_extension_not_allowed: "Attachment extension %{extension} is not allowed"
error_ldap_bind_credentials: "Invalid LDAP Account/Password" error_ldap_bind_credentials: "Invalid LDAP Account/Password"
error_no_tracker_allowed_for_new_issue_in_project: "The project doesn't have any trackers for which you can create an issue" error_no_tracker_allowed_for_new_issue_in_project: "The project doesn't have any trackers for which you can create an issue"
error_no_projects_with_tracker_allowed_for_new_issue: "There are no projects with trackers for which you can create an issue"
mail_subject_lost_password: "Your %{value} password" mail_subject_lost_password: "Your %{value} password"
mail_body_lost_password: 'To change your password, click on the following link:' mail_body_lost_password: 'To change your password, click on the following link:'

View File

@@ -234,6 +234,7 @@ fr:
error_attachment_extension_not_allowed: "L'extension %{extension} n'est pas autorisée" error_attachment_extension_not_allowed: "L'extension %{extension} n'est pas autorisée"
error_ldap_bind_credentials: "Identifiant ou mot de passe LDAP incorrect" error_ldap_bind_credentials: "Identifiant ou mot de passe LDAP incorrect"
error_no_tracker_allowed_for_new_issue_in_project: "Le projet ne dispose d'aucun tracker sur lequel vous pouvez créer une demande" error_no_tracker_allowed_for_new_issue_in_project: "Le projet ne dispose d'aucun tracker sur lequel vous pouvez créer une demande"
error_no_projects_with_tracker_allowed_for_new_issue: "Aucun projet ne dispose d'un tracker sur lequel vous pouvez créer une demande"
mail_subject_lost_password: "Votre mot de passe %{value}" mail_subject_lost_password: "Votre mot de passe %{value}"
mail_body_lost_password: 'Pour changer votre mot de passe, cliquez sur le lien suivant :' mail_body_lost_password: 'Pour changer votre mot de passe, cliquez sur le lien suivant :'

View File

@@ -1900,6 +1900,24 @@ class IssuesControllerTest < ActionController::TestCase
assert_response 403 assert_response 403
end end
def test_new_without_projects_should_respond_with_403
Project.delete_all
@request.session[:user_id] = 2
get :new
assert_response 403
assert_select_error /no projects/
end
def test_new_without_enabled_trackers_on_projects_should_respond_with_403
Project.all.each {|p| p.trackers.clear }
@request.session[:user_id] = 2
get :new
assert_response 403
assert_select_error /no projects/
end
def test_new_should_preselect_default_version def test_new_should_preselect_default_version
version = Version.generate!(:project_id => 1) version = Version.generate!(:project_id => 1)
Project.find(1).update_attribute :default_version_id, version.id Project.find(1).update_attribute :default_version_id, version.id