1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +00:00

Don't destructively insert builtin_role into roles (#23519).

git-svn-id: http://svn.redmine.org/redmine/trunk@16155 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2017-01-07 11:41:59 +00:00
parent 34a933a580
commit eef5023886

View File

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