Fixes behaviour of move_issues permission for non member role (#5309).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3683 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2010-04-18 12:47:41 +00:00
parent de51e16d2b
commit 0004b52646
3 changed files with 34 additions and 8 deletions
+16
View File
@@ -600,6 +600,22 @@ class Issue < ActiveRecord::Base
end
# End ReportsController extraction
# Returns an array of projects that current user can move issues to
def self.allowed_target_projects_on_move
projects = []
if User.current.admin?
# admin is allowed to move issues to any active (visible) project
projects = Project.visible.all
elsif User.current.logged?
if Role.non_member.allowed_to?(:move_issues)
projects = Project.visible.all
else
User.current.memberships.each {|m| projects << m.project if m.roles.detect {|r| r.allowed_to?(:move_issues)}}
end
end
projects
end
private
def update_nested_set_attributes