mirror of
https://github.com/redmine/redmine.git
synced 2026-05-06 22:46:53 +02:00
Consider only roles with either add_issues or edit_issues permissions for any status transitions (#37635).
Patch by Holger Just. git-svn-id: https://svn.redmine.org/redmine/trunk@21817 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -859,6 +859,28 @@ class IssueTest < ActiveSupport::TestCase
|
||||
assert_equal expected_statuses, issue.new_statuses_allowed_to(admin)
|
||||
end
|
||||
|
||||
def test_new_statuses_allowed_to_should_only_return_transitions_of_considered_workflows
|
||||
issue = Issue.find(9)
|
||||
|
||||
WorkflowTransition.delete_all
|
||||
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2)
|
||||
|
||||
developer = Role.find(2)
|
||||
developer.remove_permission! :edit_issues
|
||||
developer.remove_permission! :add_issues
|
||||
assert !developer.consider_workflow?
|
||||
WorkflowTransition.create!(:role_id => 2, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3)
|
||||
|
||||
# status 3 is not displayed
|
||||
expected_statuses = IssueStatus.where(:id => [1, 2])
|
||||
|
||||
admin = User.find(1)
|
||||
assert_equal expected_statuses, issue.new_statuses_allowed_to(admin)
|
||||
|
||||
author = User.find(8)
|
||||
assert_equal expected_statuses, issue.new_statuses_allowed_to(author)
|
||||
end
|
||||
|
||||
def test_new_statuses_allowed_to_should_return_allowed_statuses_when_copying
|
||||
Tracker.find(1).generate_transitions! :role_id => 1, :clear => true, 0 => [1, 3]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user