diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-05-13 15:58:54 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-05-13 15:58:54 +0000 |
commit | 566d0a6ceb12cab07f20469e2bde67f4200202dd (patch) | |
tree | 4688bf0a96b2f913e8d2d69f0c1495abee8c3a0c | |
parent | 09a613b03598c7b6ccafa65a2597bcba1f95a262 (diff) | |
download | redmine-566d0a6ceb12cab07f20469e2bde67f4200202dd.tar.gz redmine-566d0a6ceb12cab07f20469e2bde67f4200202dd.zip |
Fixed: issue move by non-admin broken by r2726 (#3354).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2738 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/controllers/issues_controller.rb | 2 | ||||
-rw-r--r-- | test/functional/issues_controller_test.rb | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 24c204098..d5ce9512e 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -284,7 +284,7 @@ class IssuesController < ApplicationController # admin is allowed to move issues to any active (visible) project @allowed_projects = Project.find(:all, :conditions => Project.visible_by(User.current)) else - User.current.memberships.each {|m| @allowed_projects << m.project if m.role.allowed_to?(:move_issues)} + User.current.memberships.each {|m| @allowed_projects << m.project if m.roles.detect {|r| r.allowed_to?(:move_issues)}} end @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id] @target_project ||= @project diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 2bb95f8bf..c7b32e0ed 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -905,14 +905,14 @@ class IssuesControllerTest < Test::Unit::TestCase end def test_move_one_issue_to_another_project - @request.session[:user_id] = 1 + @request.session[:user_id] = 2 post :move, :id => 1, :new_project_id => 2 assert_redirected_to :action => 'index', :project_id => 'ecookbook' assert_equal 2, Issue.find(1).project_id end def test_bulk_move_to_another_project - @request.session[:user_id] = 1 + @request.session[:user_id] = 2 post :move, :ids => [1, 2], :new_project_id => 2 assert_redirected_to :action => 'index', :project_id => 'ecookbook' # Issues moved to project 2 @@ -924,7 +924,7 @@ class IssuesControllerTest < Test::Unit::TestCase end def test_bulk_move_to_another_tracker - @request.session[:user_id] = 1 + @request.session[:user_id] = 2 post :move, :ids => [1, 2], :new_tracker_id => 2 assert_redirected_to :action => 'index', :project_id => 'ecookbook' assert_equal 2, Issue.find(1).tracker_id @@ -932,7 +932,7 @@ class IssuesControllerTest < Test::Unit::TestCase end def test_bulk_copy_to_another_project - @request.session[:user_id] = 1 + @request.session[:user_id] = 2 assert_difference 'Issue.count', 2 do assert_no_difference 'Project.find(1).issues.count' do post :move, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'} |