Added ability to specify multiple projects in User#allowed_to? (#5332)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4227 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -396,6 +396,19 @@ class UserTest < ActiveSupport::TestCase
|
||||
assert ! @dlopper.allowed_to?(:delete_messages, project) #Developper
|
||||
end
|
||||
end
|
||||
|
||||
context "with multiple projects" do
|
||||
should "return false if array is empty" do
|
||||
assert ! @admin.allowed_to?(:view_project, [])
|
||||
end
|
||||
|
||||
should "return true only if user has permission on all these projects" do
|
||||
assert @admin.allowed_to?(:view_project, Project.all)
|
||||
assert ! @dlopper.allowed_to?(:view_project, Project.all) #cannot see Project(2)
|
||||
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
|
||||
end
|
||||
|
||||
context "with options[:global]" do
|
||||
should "authorize if user has at least one role that has this permission" do
|
||||
|
||||
Reference in New Issue
Block a user