mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-23 08:51:13 +00:00
Project field disappears when target project disallows user to edit the project (#24311).
git-svn-id: http://svn.redmine.org/redmine/trunk@15959 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
25a3766365
commit
e6130a1e0d
@ -8,7 +8,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @issue.safe_attribute?('project_id') && (!@issue.new_record? || @project.nil? || @issue.copy?) %>
|
<% if (@issue.safe_attribute?('project_id') || @issue.project_id_changed?) && (!@issue.new_record? || @project.nil? || @issue.copy?) %>
|
||||||
<p><%= f.select :project_id, project_tree_options_for_select(@issue.allowed_target_projects, :selected => @issue.project), {:required => true},
|
<p><%= f.select :project_id, project_tree_options_for_select(@issue.allowed_target_projects, :selected => @issue.project), {:required => true},
|
||||||
:onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %></p>
|
:onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@ -3150,6 +3150,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
|||||||
get :edit, :id => 1
|
get :edit, :id => 1
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
|
assert_select 'select[name=?]', 'issue[project_id]'
|
||||||
# Be sure we don't display inactive IssuePriorities
|
# Be sure we don't display inactive IssuePriorities
|
||||||
assert ! IssuePriority.find(15).active?
|
assert ! IssuePriority.find(15).active?
|
||||||
assert_select 'select[name=?]', 'issue[priority_id]' do
|
assert_select 'select[name=?]', 'issue[priority_id]' do
|
||||||
@ -3157,6 +3158,25 @@ class IssuesControllerTest < Redmine::ControllerTest
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_edit_should_hide_project_if_user_is_not_allowed_to_change_project
|
||||||
|
WorkflowPermission.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :field_name => 'project_id', :rule => 'readonly')
|
||||||
|
|
||||||
|
@request.session[:user_id] = 2
|
||||||
|
get :edit, :id => 1
|
||||||
|
assert_response :success
|
||||||
|
assert_select 'select[name=?]', 'issue[project_id]', 0
|
||||||
|
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')
|
||||||
|
issue = Issue.generate!(:project_id => 2)
|
||||||
|
|
||||||
|
@request.session[:user_id] = 2
|
||||||
|
get :edit, :id => issue.id, :issue => {:project_id => 1}
|
||||||
|
assert_response :success
|
||||||
|
assert_select 'select[name=?]', 'issue[project_id]'
|
||||||
|
end
|
||||||
|
|
||||||
def test_get_edit_should_display_the_time_entry_form_with_log_time_permission
|
def test_get_edit_should_display_the_time_entry_form_with_log_time_permission
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
Role.find_by_name('Manager').update_attribute :permissions, [:view_issues, :edit_issues, :log_time]
|
Role.find_by_name('Manager').update_attribute :permissions, [:view_issues, :edit_issues, :log_time]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user