@@ -1428,6 +1428,11 class Issue < ActiveRecord::Base | |||
|
1428 | 1428 | private |
|
1429 | 1429 | |
|
1430 | 1430 | def user_tracker_permission?(user, permission) |
|
1431 | if project && !project.active? | |
|
1432 | perm = Redmine::AccessControl.permission(permission) | |
|
1433 | return false unless perm && perm.read? | |
|
1434 | end | |
|
1435 | ||
|
1431 | 1436 | if user.admin? |
|
1432 | 1437 | true |
|
1433 | 1438 | else |
@@ -1755,6 +1755,25 class IssuesControllerTest < ActionController::TestCase | |||
|
1755 | 1755 | assert_response 404 |
|
1756 | 1756 | end |
|
1757 | 1757 | |
|
1758 | def test_show_on_active_project_should_display_edit_links | |
|
1759 | @request.session[:user_id] = 1 | |
|
1760 | ||
|
1761 | get :show, :id => 1 | |
|
1762 | assert_response :success | |
|
1763 | assert_select 'a', :text => 'Edit' | |
|
1764 | assert_select 'a', :text => 'Delete' | |
|
1765 | end | |
|
1766 | ||
|
1767 | def test_show_on_closed_project_should_not_display_edit_links | |
|
1768 | Issue.find(1).project.close | |
|
1769 | @request.session[:user_id] = 1 | |
|
1770 | ||
|
1771 | get :show, :id => 1 | |
|
1772 | assert_response :success | |
|
1773 | assert_select 'a', :text => 'Edit', :count => 0 | |
|
1774 | assert_select 'a', :text => 'Delete', :count => 0 | |
|
1775 | end | |
|
1776 | ||
|
1758 | 1777 | def test_get_new |
|
1759 | 1778 | @request.session[:user_id] = 2 |
|
1760 | 1779 | get :new, :project_id => 1, :tracker_id => 1 |
@@ -519,6 +519,22 class IssueTest < ActiveSupport::TestCase | |||
|
519 | 519 | assert_equal [issue], Issue.assigned_to(user).to_a |
|
520 | 520 | end |
|
521 | 521 | |
|
522 | def test_issue_should_be_readonly_on_closed_project | |
|
523 | issue = Issue.find(1) | |
|
524 | user = User.find(1) | |
|
525 | ||
|
526 | assert_equal true, issue.visible?(user) | |
|
527 | assert_equal true, issue.editable?(user) | |
|
528 | assert_equal true, issue.deletable?(user) | |
|
529 | ||
|
530 | issue.project.close | |
|
531 | issue.reload | |
|
532 | ||
|
533 | assert_equal true, issue.visible?(user) | |
|
534 | assert_equal false, issue.editable?(user) | |
|
535 | assert_equal false, issue.deletable?(user) | |
|
536 | end | |
|
537 | ||
|
522 | 538 | def test_errors_full_messages_should_include_custom_fields_errors |
|
523 | 539 | field = IssueCustomField.find_by_name('Database') |
|
524 | 540 |
General Comments 0
You need to be logged in to leave comments.
Login now