From 2d9b803025828869c50a70db25fb7654caa17368 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Wed, 26 Sep 2018 12:37:43 +0200 Subject: [PATCH] Use UserRoleAssociation to get private roles If I understand this correctly this should work even if the user email changes. --- lib/galaxy/security/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/security/__init__.py b/lib/galaxy/security/__init__.py index 654c5d85b58..ef396cc9ad1 100644 --- a/lib/galaxy/security/__init__.py +++ b/lib/galaxy/security/__init__.py @@ -766,7 +766,8 @@ class GalaxyRBACAgent(RBACAgent): def get_private_user_role(self, user, auto_create=False): role = self.sa_session.query(self.model.Role) \ - .filter(and_(self.model.Role.table.c.name == user.email, + .filter(and_(self.model.UserRoleAssociation.table.c.user_id == user.id, + self.model.Role.table.c.id == self.model.UserRoleAssociation.table.c.role_id, self.model.Role.table.c.type == self.model.Role.types.PRIVATE)) \ .first() if not role: