Fix manager access to accounts page #217
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user