mirror of
https://github.com/redmine/redmine.git
synced 2025-11-06 05:16:12 +01:00
Prevent roles loading on each call to User#managed_roles for admins.
git-svn-id: http://svn.redmine.org/redmine/trunk@14328 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -157,6 +157,7 @@ class User < Principal
|
|||||||
@notified_projects_ids_changed = false
|
@notified_projects_ids_changed = false
|
||||||
@builtin_role = nil
|
@builtin_role = nil
|
||||||
@visible_project_ids = nil
|
@visible_project_ids = nil
|
||||||
|
@managed_roles = nil
|
||||||
base_reload(*args)
|
base_reload(*args)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -569,7 +570,7 @@ class User < Principal
|
|||||||
# Returns the roles that the user is allowed to manage for the given project
|
# Returns the roles that the user is allowed to manage for the given project
|
||||||
def managed_roles(project)
|
def managed_roles(project)
|
||||||
if admin?
|
if admin?
|
||||||
Role.givable.to_a
|
@managed_roles ||= Role.givable.to_a
|
||||||
else
|
else
|
||||||
membership(project).try(:managed_roles) || []
|
membership(project).try(:managed_roles) || []
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user