elsif project && project.is_a?(Array)
# Authorize if user is authorized on every element of the array
- project.inject do |memo,p|
- memo && allowed_to?(action,p,options)
+ project.map do |p|
+ allowed_to?(action,p,options)
+ end.inject do |memo,p|
+ memo && p
end
elsif options[:global]
# Admin users are always authorized
assert @jsmith.allowed_to?(:edit_issues, @jsmith.projects) #Manager or Developer everywhere
assert ! @jsmith.allowed_to?(:delete_issue_watchers, @jsmith.projects) #Dev cannot delete_issue_watchers
end
+
+ should "behave correctly with arrays of 1 project" do
+ assert ! User.anonymous.allowed_to?(:delete_issues, [Project.first])
+ end
end
context "with options[:global]" do