diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-03-20 09:17:54 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-03-20 09:17:54 +0000 |
commit | 84c8ca6fefa3266527b754944ccb15e9393b1ae7 (patch) | |
tree | 57494dfa5abdf03e9bdc71a6fc11e2102ce3c551 /test/unit/issue_test.rb | |
parent | 86c6afb5459c20888d6e8d6803b08bc60fdabf86 (diff) | |
download | redmine-84c8ca6fefa3266527b754944ccb15e9393b1ae7.tar.gz redmine-84c8ca6fefa3266527b754944ccb15e9393b1ae7.zip |
Fixed that custom fields with hidden/read-only combination may be displayed on issue form (#19297).
git-svn-id: http://svn.redmine.org/redmine/trunk@14137 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r-- | test/unit/issue_test.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 25ccb0812..5d11f8cc3 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -911,7 +911,7 @@ class IssueTest < ActiveSupport::TestCase assert_equal [], issue.required_attribute_names(user.reload) WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, - :role_id => 2, :field_name => 'due_date', + :role_id => 3, :field_name => 'due_date', :rule => 'readonly') # required + readonly => required assert_equal %w(due_date), issue.required_attribute_names(user) @@ -941,6 +941,23 @@ class IssueTest < ActiveSupport::TestCase assert_equal %w(due_date), issue.read_only_attribute_names(user) end + # A field that is not visible by role 2 and readonly by role 1 should be readonly for user with role 1 and 2 + def test_read_only_attribute_names_should_include_custom_fields_that_combine_readonly_and_not_visible_for_roles + field = IssueCustomField.generate!( + :is_for_all => true, :trackers => Tracker.all, :visible => false, :role_ids => [1] + ) + WorkflowPermission.delete_all + WorkflowPermission.create!( + :old_status_id => 1, :tracker_id => 1, :role_id => 1, :field_name => field.id, :rule => 'readonly' + ) + user = User.generate! + project = Project.find(1) + User.add_to_project(user, project, Role.where(:id => [1, 2])) + + issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1) + assert_equal [field.id.to_s], issue.read_only_attribute_names(user) + end + def test_workflow_rules_should_ignore_roles_without_issue_permissions role = Role.generate! :permissions => [:view_issues, :edit_issues] ignored_role = Role.generate! :permissions => [:view_issues] |