mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
Edit/delete links displayed on issue even if project is closed (#23969).
git-svn-id: http://svn.redmine.org/redmine/trunk@15879 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
51227270bd
commit
d4f57cc2fa
@ -1436,6 +1436,11 @@ class Issue < ActiveRecord::Base
|
|||||||
private
|
private
|
||||||
|
|
||||||
def user_tracker_permission?(user, permission)
|
def user_tracker_permission?(user, permission)
|
||||||
|
if project && !project.active?
|
||||||
|
perm = Redmine::AccessControl.permission(permission)
|
||||||
|
return false unless perm && perm.read?
|
||||||
|
end
|
||||||
|
|
||||||
if user.admin?
|
if user.admin?
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1679,6 +1679,25 @@ class IssuesControllerTest < Redmine::ControllerTest
|
|||||||
assert_response 404
|
assert_response 404
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_show_on_active_project_should_display_edit_links
|
||||||
|
@request.session[:user_id] = 1
|
||||||
|
|
||||||
|
get :show, :id => 1
|
||||||
|
assert_response :success
|
||||||
|
assert_select 'a', :text => 'Edit'
|
||||||
|
assert_select 'a', :text => 'Delete'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_show_on_closed_project_should_not_display_edit_links
|
||||||
|
Issue.find(1).project.close
|
||||||
|
@request.session[:user_id] = 1
|
||||||
|
|
||||||
|
get :show, :id => 1
|
||||||
|
assert_response :success
|
||||||
|
assert_select 'a', :text => 'Edit', :count => 0
|
||||||
|
assert_select 'a', :text => 'Delete', :count => 0
|
||||||
|
end
|
||||||
|
|
||||||
def test_get_new
|
def test_get_new
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
get :new, :project_id => 1, :tracker_id => 1
|
get :new, :project_id => 1, :tracker_id => 1
|
||||||
|
|||||||
@ -519,6 +519,22 @@ class IssueTest < ActiveSupport::TestCase
|
|||||||
assert_equal [issue], Issue.assigned_to(user).to_a
|
assert_equal [issue], Issue.assigned_to(user).to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_issue_should_be_readonly_on_closed_project
|
||||||
|
issue = Issue.find(1)
|
||||||
|
user = User.find(1)
|
||||||
|
|
||||||
|
assert_equal true, issue.visible?(user)
|
||||||
|
assert_equal true, issue.editable?(user)
|
||||||
|
assert_equal true, issue.deletable?(user)
|
||||||
|
|
||||||
|
issue.project.close
|
||||||
|
issue.reload
|
||||||
|
|
||||||
|
assert_equal true, issue.visible?(user)
|
||||||
|
assert_equal false, issue.editable?(user)
|
||||||
|
assert_equal false, issue.deletable?(user)
|
||||||
|
end
|
||||||
|
|
||||||
def test_errors_full_messages_should_include_custom_fields_errors
|
def test_errors_full_messages_should_include_custom_fields_errors
|
||||||
field = IssueCustomField.find_by_name('Database')
|
field = IssueCustomField.find_by_name('Database')
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user