mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
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:
@@ -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"
|
||||
|
||||
@@ -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']
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user