@@ -348,8 +348,7 class Issue < ActiveRecord::Base | |||||
348 | if issue.new_record? |
|
348 | if issue.new_record? | |
349 | issue.copy? |
|
349 | issue.copy? | |
350 | elsif user.allowed_to?(:move_issues, issue.project) |
|
350 | elsif user.allowed_to?(:move_issues, issue.project) | |
351 |
|
|
351 | Issue.allowed_target_projects_on_move.count > 1 | |
352 | projects.include?(issue.project) && projects.size > 1 |
|
|||
353 | end |
|
352 | end | |
354 | } |
|
353 | } | |
355 |
|
354 | |||
@@ -416,7 +415,7 class Issue < ActiveRecord::Base | |||||
416 |
|
415 | |||
417 | # Project and Tracker must be set before since new_statuses_allowed_to depends on it. |
|
416 | # Project and Tracker must be set before since new_statuses_allowed_to depends on it. | |
418 | if (p = attrs.delete('project_id')) && safe_attribute?('project_id') |
|
417 | if (p = attrs.delete('project_id')) && safe_attribute?('project_id') | |
419 |
if allowed_target_projects(user). |
|
418 | if allowed_target_projects(user).where(:id => p.to_i).exists? | |
420 | self.project_id = p |
|
419 | self.project_id = p | |
421 | end |
|
420 | end | |
422 | end |
|
421 | end | |
@@ -1184,18 +1183,18 class Issue < ActiveRecord::Base | |||||
1184 | end |
|
1183 | end | |
1185 | # End ReportsController extraction |
|
1184 | # End ReportsController extraction | |
1186 |
|
1185 | |||
1187 |
# Returns a |
|
1186 | # Returns a scope of projects that user can assign the issue to | |
1188 | def allowed_target_projects(user=User.current) |
|
1187 | def allowed_target_projects(user=User.current) | |
1189 | if new_record? |
|
1188 | if new_record? | |
1190 |
Project. |
|
1189 | Project.where(Project.allowed_to_condition(user, :add_issues)) | |
1191 | else |
|
1190 | else | |
1192 | self.class.allowed_target_projects_on_move(user) |
|
1191 | self.class.allowed_target_projects_on_move(user) | |
1193 | end |
|
1192 | end | |
1194 | end |
|
1193 | end | |
1195 |
|
1194 | |||
1196 |
# Returns a |
|
1195 | # Returns a scope of projects that user can move issues to | |
1197 | def self.allowed_target_projects_on_move(user=User.current) |
|
1196 | def self.allowed_target_projects_on_move(user=User.current) | |
1198 |
Project. |
|
1197 | Project.where(Project.allowed_to_condition(user, :move_issues)) | |
1199 | end |
|
1198 | end | |
1200 |
|
1199 | |||
1201 | private |
|
1200 | private |
General Comments 0
You need to be logged in to leave comments.
Login now