diff options
author | Jean-Baptiste Barth <jeanbaptiste.barth@gmail.com> | 2010-09-29 05:22:45 +0000 |
---|---|---|
committer | Jean-Baptiste Barth <jeanbaptiste.barth@gmail.com> | 2010-09-29 05:22:45 +0000 |
commit | e8f3dd07dd8462d8d80948d5c8f094bdcc966d9a (patch) | |
tree | 7f2110ce12961a4faf6552d496f4e26e722fd4e1 /test | |
parent | fda1a0cb3b57830679405de1859270673bdcb0ba (diff) | |
download | redmine-e8f3dd07dd8462d8d80948d5c8f094bdcc966d9a.tar.gz redmine-e8f3dd07dd8462d8d80948d5c8f094bdcc966d9a.zip |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/user_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index f3e56ddd3..b451c1e6b 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -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 |