fix: keep admin access to connections without access grants when admin bypass is disabled (#27581)

This commit is contained in:
G30
2026-07-27 03:39:40 -04:00
committed by GitHub
parent be1b811ce5
commit 867006acce
3 changed files with 9 additions and 3 deletions
@@ -163,10 +163,16 @@ async def has_connection_access(
if user.role == 'admin' and BYPASS_ADMIN_ACCESS_CONTROL:
return True
access_grants = (connection.get('config') or {}).get('access_grants', [])
if not access_grants:
# No grants configured → private, admin-only: admins must keep access
# to connections only they can configure, even when they do not bypass
# access control globally.
return user.role == 'admin'
if user_group_ids is None:
user_group_ids = {group.id for group in await Groups.get_groups_by_member_id(user.id)}
access_grants = (connection.get('config') or {}).get('access_grants', [])
return await has_access(user.id, 'read', access_grants, user_group_ids)