]> source.dussan.org Git - redmine.git/commitdiff
Don't destructively insert builtin_role into roles (#23519).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 7 Jan 2017 11:41:59 +0000 (11:41 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 7 Jan 2017 11:41:59 +0000 (11:41 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@16155 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/user.rb

index 24fd47464cb6e223c383c62c2a583b2f39199503..150cc27bb58229a0f43e025de31d7f86c2a5cef0 100644 (file)
@@ -678,9 +678,8 @@ class User < Principal
       return true if admin?
 
       # authorize if user has at least one role that has this permission
-      rls = self.roles.to_a
-      rls << builtin_role
-      rls.any? {|role|
+      roles = self.roles.to_a | [builtin_role]
+      roles.any? {|role|
         role.allowed_to?(action) &&
         (block_given? ? yield(role, self) : true)
       }