Fix bug on UserGroupAssoc mapping (see note)

This is the same bug as the one fixed on the main model in
https://github.com/galaxyproject/galaxy/commit/174d8b53ac4d48ac6950c579539537da42a6a2e8
This commit is contained in:
Sergey Golitsynskiy
2021-10-13 10:16:56 -04:00
parent ddf1135eda
commit 500dc77bb3
4 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -259,8 +259,8 @@ class GroupGrid(grids.Grid):
class UsersColumn(grids.GridColumn):
def get_value(self, trans, grid, group):
if group.members:
return len(group.members)
if group.users:
return len(group.users)
return 0
title = "Groups"
+1 -1
View File
@@ -174,7 +174,7 @@ class Group(Base, Dictifiable, _HasTable):
name = Column(String(255), index=True, unique=True)
deleted = Column(Boolean, index=True, default=False)
roles = relationship('GroupRoleAssociation', back_populates='group')
users = relationship('UserGroupAssociation') # TODO: fix bug: incorrect usage of backref/duplicate rel users/members; add back_populates
users = relationship('UserGroupAssociation', back_populates='group')
dict_collection_visible_keys = ['id', 'name']
dict_element_visible_keys = ['id', 'name']
+1 -1
View File
@@ -108,7 +108,7 @@ mapper_registry.map_imperatively(RepositoryRoleAssociation, RepositoryRoleAssoci
mapper_registry.map_imperatively(UserGroupAssociation, UserGroupAssociation.table,
properties=dict(user=relation(User, backref="groups"),
group=relation(Group, backref="members"))) # TODO fix bug: members should be users; check codebase for references
group=relation(Group, back_populates="users")))
mapper_registry.map_imperatively(UserRoleAssociation, UserRoleAssociation.table,
properties=dict(
+1 -1
View File
@@ -234,7 +234,7 @@ class CommunityRBACAgent(RBACAgent):
# of a group that is associated with the role.
for gra in role.groups:
group = gra.group
for uga in group.members:
for uga in group.users:
member = uga.user
if member.id == user.id:
return True