pénzügyi modul továbbfejlesztése (csomagkezelés)
This commit is contained in:
@@ -256,8 +256,15 @@ async def get_user_vehicles(
|
||||
# Use a raw SQL expression for JSONB boolean ordering
|
||||
order_expr = text("(individual_equipment->>'is_primary')::boolean DESC NULLS LAST")
|
||||
|
||||
if current_user.scope_id is None:
|
||||
# Personal mode: show vehicles in organizations where user is a member
|
||||
# P0 BUGFIX (2026-07-28): Staff users (ADMIN, SUPERADMIN, MODERATOR, etc.)
|
||||
# should NOT enter corporate mode even if scope_id is set. They need to
|
||||
# see vehicles through the personal/org membership path.
|
||||
staff_roles = {'SUPERADMIN', 'ADMIN', 'MODERATOR', 'SALES_REP', 'SERVICE_MGR'}
|
||||
current_role = current_user.role.upper() if current_user.role else ''
|
||||
is_staff_user = current_role in staff_roles
|
||||
|
||||
if current_user.scope_id is None or is_staff_user:
|
||||
# Personal mode OR staff user: show vehicles in organizations where user is a member
|
||||
org_stmt = select(OrganizationMember.organization_id).where(
|
||||
OrganizationMember.user_id == current_user.id
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user