Patch #13545 » issie_permissions.diff
app/models/issue.rb 2013-03-21 13:46:55.000000000 +0000 | ||
---|---|---|
509 | 509 | |
510 | 510 |
result = {} |
511 | 511 |
workflow_permissions = WorkflowPermission.where(:tracker_id => tracker_id, :old_status_id => status_id, :role_id => roles.map(&:id)).all |
512 | 512 |
if workflow_permissions.any? |
513 | 513 |
workflow_rules = workflow_permissions.inject({}) do |h, wp| |
514 | 514 |
h[wp.field_name] ||= [] |
515 | 515 |
h[wp.field_name] << wp.rule |
516 | 516 |
h |
517 | 517 |
end |
518 | 518 |
workflow_rules.each do |attr, rules| |
519 |
next if rules.size < roles.size |
|
520 | 519 |
uniq_rules = rules.uniq |
521 | 520 |
if uniq_rules.size == 1 |
522 | 521 |
result[attr] = uniq_rules.first |
523 | 522 |
else |
524 | 523 |
result[attr] = 'required' |
525 | 524 |
end |
526 | 525 |
end |
527 | 526 |
end |
528 | 527 |
@workflow_rule_by_attribute = result if user.nil? |
529 | 528 |
result |