Skip to content

Commit

Permalink
Fix bug by using model association instead of string comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Oct 4, 2024
1 parent 1f5a9f1 commit d551f9b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/galaxy/model/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,10 +792,13 @@ def create_role(self, name, description, in_users, in_groups, create_group_for_r
return role, num_in_groups

def get_sharing_roles(self, user):
stmt = select(Role).where(
and_((Role.name).like(f"Sharing role for: %{user.email}%"), Role.type == Role.types.SHARING)
stmt = (
select(Role)
.join(Role.users)
.where(UserRoleAssociation.user_id == user.id)
.where(Role.type == Role.types.SHARING)
)
return self.sa_session.scalars(stmt)
return self.sa_session.scalars(stmt).all()

def user_set_default_permissions(
self,
Expand Down

0 comments on commit d551f9b

Please sign in to comment.