You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2012/09/21 22:18:33 UTC
[2/16] git commit: [#4445] Fixed test failing due to cached user roles
[#4445] Fixed test failing due to cached user roles
Signed-off-by: Cory Johns <jo...@geek.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/8404edfd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8404edfd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8404edfd
Branch: refs/heads/master
Commit: 8404edfda5cd84272789f65b03723d1e7202acd7
Parents: 3eb1feb
Author: Cory Johns <jo...@geek.net>
Authored: Fri Sep 21 17:32:52 2012 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Fri Sep 21 18:36:16 2012 +0000
----------------------------------------------------------------------
Allura/allura/lib/plugin.py | 3 +++
Allura/allura/lib/security.py | 3 +++
2 files changed, 6 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8404edfd/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index f0c923c6..ffeb3df 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -497,6 +497,9 @@ class ProjectRegistrationProvider(object):
project_template['icon']['filename'], icon_file,
square=True, thumbnail_size=(48, 48),
thumbnail_meta=dict(project_id=p._id, category='icon'))
+ # clear the RoleCache for the user so this project will
+ # be picked up by user.my_projects()
+ g.credentials.clear_user(user._id)
except forge_exc.ProjectConflict:
raise
except:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8404edfd/Allura/allura/lib/security.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/security.py b/Allura/allura/lib/security.py
index 2f16b32..0d48fbf 100644
--- a/Allura/allura/lib/security.py
+++ b/Allura/allura/lib/security.py
@@ -32,6 +32,9 @@ class Credentials(object):
self.users = {}
self.projects = {}
+ def clear_user(self, user_id, project_id=None):
+ self.users.pop((user_id, project_id), None)
+
def load_user_roles(self, user_id, *project_ids):
'''Load the credentials with all user roles for a set of projects'''
from allura import model as M