summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-06-17 18:36:38 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-06-17 18:36:38 +0000
commitba61b13008afd0c9d7fcd80d51a7628930b4566a (patch)
treee10171aa856f4cfdacb18b605ed07ae60b2ccdf2 /app
parent0d1da58a99a0e518385ff3585eff057276e46e07 (diff)
downloadredmine-ba61b13008afd0c9d7fcd80d51a7628930b4566a.tar.gz
redmine-ba61b13008afd0c9d7fcd80d51a7628930b4566a.zip
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
Diffstat (limited to 'app')
-rw-r--r--app/models/user.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 9ff706178..b36447cad 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -157,6 +157,7 @@ class User < Principal
@notified_projects_ids_changed = false
@builtin_role = nil
@visible_project_ids = nil
+ @managed_roles = nil
base_reload(*args)
end
@@ -569,7 +570,7 @@ class User < Principal
# Returns the roles that the user is allowed to manage for the given project
def managed_roles(project)
if admin?
- Role.givable.to_a
+ @managed_roles ||= Role.givable.to_a
else
membership(project).try(:managed_roles) || []
end