@@ -368,8 +368,10 class User < Principal | |||
|
368 | 368 | |
|
369 | 369 | elsif project && project.is_a?(Array) |
|
370 | 370 | # Authorize if user is authorized on every element of the array |
|
371 |
project. |
|
|
372 |
|
|
|
371 | project.map do |p| | |
|
372 | allowed_to?(action,p,options) | |
|
373 | end.inject do |memo,p| | |
|
374 | memo && p | |
|
373 | 375 | end |
|
374 | 376 | elsif options[:global] |
|
375 | 377 | # Admin users are always authorized |
@@ -408,6 +408,10 class UserTest < ActiveSupport::TestCase | |||
|
408 | 408 | assert @jsmith.allowed_to?(:edit_issues, @jsmith.projects) #Manager or Developer everywhere |
|
409 | 409 | assert ! @jsmith.allowed_to?(:delete_issue_watchers, @jsmith.projects) #Dev cannot delete_issue_watchers |
|
410 | 410 | end |
|
411 | ||
|
412 | should "behave correctly with arrays of 1 project" do | |
|
413 | assert ! User.anonymous.allowed_to?(:delete_issues, [Project.first]) | |
|
414 | end | |
|
411 | 415 | end |
|
412 | 416 | |
|
413 | 417 | context "with options[:global]" do |
General Comments 0
You need to be logged in to leave comments.
Login now