Commit 2d9b8030 authored by mvdbeek's avatar mvdbeek
Browse files

Use UserRoleAssociation to get private roles

If I understand this correctly this should work even if the user email
changes.
parent 02c17715
...@@ -766,7 +766,8 @@ class GalaxyRBACAgent(RBACAgent): ...@@ -766,7 +766,8 @@ class GalaxyRBACAgent(RBACAgent):
def get_private_user_role(self, user, auto_create=False): def get_private_user_role(self, user, auto_create=False):
role = self.sa_session.query(self.model.Role) \ 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)) \ self.model.Role.table.c.type == self.model.Role.types.PRIVATE)) \
.first() .first()
if not role: if not role:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment