summaryrefslogtreecommitdiffstats
path: root/test/functional/issues_controller_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-10-31 09:04:46 +0000
committerGo MAEDA <maeda@farend.jp>2022-10-31 09:04:46 +0000
commite1928aaf1944559ce3fd5594fe0988d42719c689 (patch)
tree45b55a35280d0ae43442b23b3f32ad92edba21e5 /test/functional/issues_controller_test.rb
parente881e11021528b8da32b7ea0c093a866f981300d (diff)
downloadredmine-e1928aaf1944559ce3fd5594fe0988d42719c689.tar.gz
redmine-e1928aaf1944559ce3fd5594fe0988d42719c689.zip
Read-only field permission for the project field is ignored if the current project has subprojects (#37685).
Patch by salman mp. git-svn-id: https://svn.redmine.org/redmine/trunk@21937 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/issues_controller_test.rb')
-rw-r--r--test/functional/issues_controller_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index e47462b21..a10abbd12 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -5665,6 +5665,26 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'select[name=?]', 'issue[project_id]', 0
end
+ def test_new_should_hide_project_if_user_is_not_allowed_to_change_project_in_hierarchy_projects
+ WorkflowPermission.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1,
+ :field_name => 'project_id', :rule => 'readonly')
+
+ @request.session[:user_id] = 2
+ get(:new, :params => { :tracker_id => 1, :project_id => 1 })
+ assert_response :success
+ assert_select 'select[name=?]', 'issue[project_id]', 0
+ end
+
+ def test_new_should_show_project_if_user_is_not_allowed_to_change_project_global_new_issue
+ WorkflowPermission.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1,
+ :field_name => 'project_id', :rule => 'readonly')
+
+ @request.session[:user_id] = 2
+ get(:new, :params => { :tracker_id => 1})
+ assert_response :success
+ assert_select 'select[name=?]', 'issue[project_id]'
+ end
+
def test_edit_should_not_hide_project_when_user_changes_the_project_even_if_project_is_readonly_on_target_project
WorkflowPermission.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1,
:field_name => 'project_id', :rule => 'readonly')