Fix manager access to accounts page #217

Merged
erfanian merged 1 commits from fix/manager-accounts into dev 2026-07-13 23:33:05 +02:00
@@ -225,9 +225,19 @@ def list_organizations(
.where(Organization.deleted.is_not(True))
.order_by(Organization.name)
).all()
elif access_token.effective_role == UserRole.ADMIN:
organization = session.get(Organization, access_token.effective_organization_id)
organizations = [organization] if organization and not organization.deleted else []
elif access_token.effective_role in {
UserRole.ADMIN,
UserRole.MANAGER,
}:
organization = session.get(
Organization,
access_token.effective_organization_id,
)
organizations = (
[organization]
if organization and not organization.deleted
else []
)
else:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)