incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject git commit: [#7181] Refactor roles query to not unneccessarily load all project roles
Date Mon, 17 Feb 2014 19:07:12 GMT
Repository: incubator-allura
Updated Branches:
  refs/heads/master def3d739e -> 0a6523071


[#7181] Refactor roles query to not unneccessarily load all project roles

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/0a652307
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/0a652307
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/0a652307

Branch: refs/heads/master
Commit: 0a65230713e935d01f91fe57534975f39fed61b6
Parents: def3d73
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Mon Feb 17 18:26:28 2014 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Mon Feb 17 18:26:39 2014 +0000

----------------------------------------------------------------------
 Allura/allura/lib/security.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0a652307/Allura/allura/lib/security.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/security.py b/Allura/allura/lib/security.py
index a0d6c1e..edd74d9 100644
--- a/Allura/allura/lib/security.py
+++ b/Allura/allura/lib/security.py
@@ -145,12 +145,12 @@ class Credentials(object):
 
     def users_with_named_role(self, project_id, name):
         """ returns in sorted order """
-        roles = self.project_roles(project_id)
-        return sorted(RoleCache(self, roles.find(name=name)).users_that_reach, key=lambda
u: u.username)
+        role = RoleCache(self, self.project_role.find({'project_id': project_id, 'name':
name}))
+        return sorted(role.users_that_reach, key=lambda u: u.username)
 
     def userids_with_named_role(self, project_id, name):
-        roles = self.project_roles(project_id)
-        return RoleCache(self, roles.find(name=name)).userids_that_reach
+        role = RoleCache(self, self.project_role.find({'project_id': project_id, 'name':
name}))
+        return role.userids_that_reach
 
 
 class RoleCache(object):


Mime
View raw message