Skip to content

Row-level security

Generated by pnpm docs:reference from the local database (BE-M0-31). Never edit this page by hand (D27).

A table without a policy for an action refuses that action to every app user. anon has no privileges at all.

Policy For Using With check
audit_log_read select ((pool_id = ANY (( SELECT app.pools_with_any(ARRAY['audit_log:read'::text]) AS pools_with_any)::uuid[])) OR ((pool_id IS NULL) AND (organization_id = ANY (( SELECT app.orgs_with_every_pool(ARRAY['audit_log:read'::text]) AS orgs_with_every_pool)::uuid[]))))
Policy For Using With check
background_check_photos_insert insert (app.check_pool(check_id) = ANY (( SELECT app.pools_with_any(ARRAY['screening:write'::text]) AS pools_with_any)::uuid[]))
background_check_photos_read select (app.check_pool(check_id) = ANY (( SELECT app.pools_with_any(ARRAY['screening:read'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
background_checks_insert insert (((status = ANY (ARRAY['scheduled'::check_status, 'cancelled'::check_status])) AND (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['screening:write'::text]) AS pools_with_any)::uuid[]))) OR ((status = ANY (ARRAY['passed'::check_status, 'failed'::check_status, 'waived'::check_status])) AND (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['screening:approve'::text]) AS pools_with_any)::uuid[]))))
background_checks_read select (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['screening:read'::text]) AS pools_with_any)::uuid[]))
background_checks_update update (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['screening:write'::text, 'screening:approve'::text]) AS pools_with_any)::uuid[])) (((status = ANY (ARRAY['scheduled'::check_status, 'cancelled'::check_status])) AND (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['screening:write'::text]) AS pools_with_any)::uuid[]))) OR ((status = ANY (ARRAY['passed'::check_status, 'failed'::check_status, 'waived'::check_status])) AND (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['screening:approve'::text]) AS pools_with_any)::uuid[]))))
Policy For Using With check
body_panels_read select (organization_id = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))
Policy For Using With check
charge_adjustments_insert insert (app.charge_pool(charge_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:approve'::text]) AS pools_with_any)::uuid[]))
charge_adjustments_read select (app.charge_pool(charge_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:read'::text]) AS pools_with_any)::uuid[]))
charge_adjustments_update update (app.charge_pool(charge_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:approve'::text]) AS pools_with_any)::uuid[])) (app.charge_pool(charge_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:approve'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
charge_types_read select (organization_id = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))
Policy For Using With check
charges_insert insert (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:write'::text]) AS pools_with_any)::uuid[]))
charges_read select ((app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.rental_partner(rental_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
charges_update update (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:write'::text]) AS pools_with_any)::uuid[])) (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
collection_calls_read select (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:read'::text, 'debt_letter:read'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
company_bank_accounts_read select (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['master_data:read'::text, 'payment:read'::text]) AS orgs_with_any)::uuid[]))
Policy For Using With check
contract_templates_read select (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['master_data:read'::text]) AS orgs_with_any)::uuid[]))
Policy For Using With check
contracts_insert insert (app.rental_pool(rental_id) = ANY (( SELECT app.pools_with_any(ARRAY['booking:write'::text, 'onboarding:write'::text, 'inspection:handover'::text]) AS pools_with_any)::uuid[]))
contracts_read select ((app.rental_pool(rental_id) = ANY (( SELECT app.pools_with_any(ARRAY['onboarding:read'::text, 'booking:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.rental_partner(rental_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
contracts_update update (app.rental_pool(rental_id) = ANY (( SELECT app.pools_with_any(ARRAY['booking:write'::text, 'onboarding:write'::text, 'inspection:handover'::text]) AS pools_with_any)::uuid[])) (app.rental_pool(rental_id) = ANY (( SELECT app.pools_with_any(ARRAY['booking:write'::text, 'onboarding:write'::text, 'inspection:handover'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
debt_letter_items_read select (app.debt_letter_pool(debt_letter_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:read'::text, 'debt_letter:read'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
debt_letters_read select (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:read'::text, 'debt_letter:read'::text]) AS pools_with_any)::uuid[]))

No policies: app users can't read or change it.

Policy For Using With check
driver_addresses_insert insert (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
driver_addresses_read select ((app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:read'::text, 'screening:read'::text, 'onboarding:read'::text, 'booking:read'::text, 'payment:read'::text, 'inspection:read'::text, 'gate:read'::text, 'debt_letter:read'::text]) AS pools_with_any)::uuid[])) AND (organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])))
driver_addresses_update update (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[])) (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
driver_documents_insert insert (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
driver_documents_read select ((app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:read'::text, 'screening:read'::text, 'onboarding:read'::text, 'booking:read'::text, 'payment:read'::text, 'inspection:read'::text, 'gate:read'::text, 'debt_letter:read'::text]) AS pools_with_any)::uuid[])) AND (organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])))
driver_documents_update update (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[])) (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
driver_emergency_contacts_insert insert (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
driver_emergency_contacts_read select ((app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:read'::text, 'screening:read'::text, 'onboarding:read'::text, 'booking:read'::text, 'payment:read'::text, 'inspection:read'::text, 'gate:read'::text, 'debt_letter:read'::text]) AS pools_with_any)::uuid[])) AND (organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])))
driver_emergency_contacts_update update (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[])) (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
driver_notes_insert insert (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
driver_notes_read select ((app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:read'::text, 'screening:read'::text, 'onboarding:read'::text, 'booking:read'::text, 'payment:read'::text, 'inspection:read'::text, 'gate:read'::text, 'debt_letter:read'::text]) AS pools_with_any)::uuid[])) AND (organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])))
driver_notes_update update (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[])) (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
driver_platform_accounts_insert insert (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
driver_platform_accounts_read select ((app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:read'::text, 'screening:read'::text, 'onboarding:read'::text, 'booking:read'::text, 'payment:read'::text, 'inspection:read'::text, 'gate:read'::text, 'debt_letter:read'::text]) AS pools_with_any)::uuid[])) AND (organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])))
driver_platform_accounts_update update (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[])) (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
driver_trainings_insert insert (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
driver_trainings_read select ((app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:read'::text, 'screening:read'::text, 'onboarding:read'::text, 'booking:read'::text, 'payment:read'::text, 'inspection:read'::text, 'gate:read'::text, 'debt_letter:read'::text]) AS pools_with_any)::uuid[])) AND (organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])))
driver_trainings_update update (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[])) (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
drivers_delete delete (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['driver:delete'::text]) AS pools_with_any)::uuid[]))
drivers_insert insert (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
drivers_read select ((pool_id = ANY (( SELECT app.pools_with_any(ARRAY['driver:read'::text, 'screening:read'::text, 'onboarding:read'::text, 'booking:read'::text, 'payment:read'::text, 'inspection:read'::text, 'gate:read'::text, 'debt_letter:read'::text]) AS pools_with_any)::uuid[])) AND (organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])))
drivers_update update (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[])) (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
etle_scans_insert insert (app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:write'::text]) AS pools_with_any)::uuid[]))
etle_scans_read select ((app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.vehicle_partner(vehicle_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
etle_scans_update update (app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:write'::text]) AS pools_with_any)::uuid[])) (app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
etle_violations_insert insert (app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:write'::text]) AS pools_with_any)::uuid[]))
etle_violations_read select ((app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.vehicle_partner(vehicle_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
etle_violations_update update (app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:write'::text]) AS pools_with_any)::uuid[])) (app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
garages_read select (organization_id = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))
Policy For Using With check
gate_pass_approvals_insert insert (((aspect = 'debt'::gate_aspect) AND (app.gate_pass_pool(gate_pass_id) = ANY (( SELECT app.pools_with_any(ARRAY['gate_debt:approve'::text]) AS pools_with_any)::uuid[]))) OR ((aspect = 'service'::gate_aspect) AND (app.gate_pass_pool(gate_pass_id) = ANY (( SELECT app.pools_with_any(ARRAY['gate_service:approve'::text]) AS pools_with_any)::uuid[]))) OR ((aspect = 'checkpoint'::gate_aspect) AND (app.gate_pass_pool(gate_pass_id) = ANY (( SELECT app.pools_with_any(ARRAY['gate_checkpoint:approve'::text]) AS pools_with_any)::uuid[]))) OR ((aspect = 'team_use'::gate_aspect) AND (app.gate_pass_pool(gate_pass_id) = ANY (( SELECT app.pools_with_any(ARRAY['gate_team:approve'::text]) AS pools_with_any)::uuid[]))))
gate_pass_approvals_read select (app.gate_pass_pool(gate_pass_id) = ANY (( SELECT app.pools_with_any(ARRAY['gate:read'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
gate_passes_insert insert (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['gate:write'::text]) AS pools_with_any)::uuid[]))
gate_passes_read select ((pool_id = ANY (( SELECT app.pools_with_any(ARRAY['gate:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.vehicle_partner(vehicle_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
gate_passes_update update (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['gate:write'::text]) AS pools_with_any)::uuid[])) (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['gate:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
gps_devices_read select ((app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:read'::text, 'fleet_monitor:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.vehicle_partner(vehicle_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
Policy For Using With check
gps_positions_read select ((app.gps_device_pool(gps_device_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:read'::text, 'fleet_monitor:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.gps_device_partner(gps_device_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))

No policies: app users can't read or change it.

No policies: app users can't read or change it.

Policy For Using With check
inspection_damages_insert insert app.inspection_may_write(inspection_id)
inspection_damages_read select ((app.inspection_pool(inspection_id) = ANY (( SELECT app.pools_with_any(ARRAY['inspection:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.inspection_partner(inspection_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
inspection_damages_update update app.inspection_may_write(inspection_id) app.inspection_may_write(inspection_id)
Policy For Using With check
inspection_item_types_read select (organization_id = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))
Policy For Using With check
inspection_items_insert insert app.inspection_may_write(inspection_id)
inspection_items_read select ((app.inspection_pool(inspection_id) = ANY (( SELECT app.pools_with_any(ARRAY['inspection:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.inspection_partner(inspection_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
inspection_items_update update app.inspection_may_write(inspection_id) app.inspection_may_write(inspection_id)
Policy For Using With check
inspection_photos_insert insert app.inspection_may_write(inspection_id)
inspection_photos_read select ((app.inspection_pool(inspection_id) = ANY (( SELECT app.pools_with_any(ARRAY['inspection:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.inspection_partner(inspection_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
inspection_photos_update update app.inspection_may_write(inspection_id) app.inspection_may_write(inspection_id)
Policy For Using With check
inspections_insert insert (((kind = ANY (ARRAY['handover'::inspection_kind, 'return'::inspection_kind])) AND (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['inspection:handover'::text]) AS pools_with_any)::uuid[]))) OR ((kind <> ALL (ARRAY['handover'::inspection_kind, 'return'::inspection_kind])) AND (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['inspection:write'::text]) AS pools_with_any)::uuid[]))))
inspections_read select ((pool_id = ANY (( SELECT app.pools_with_any(ARRAY['inspection:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.vehicle_partner(vehicle_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
inspections_update update (((kind = ANY (ARRAY['handover'::inspection_kind, 'return'::inspection_kind])) AND (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['inspection:handover'::text]) AS pools_with_any)::uuid[]))) OR ((kind <> ALL (ARRAY['handover'::inspection_kind, 'return'::inspection_kind])) AND (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['inspection:write'::text]) AS pools_with_any)::uuid[])))) (((kind = ANY (ARRAY['handover'::inspection_kind, 'return'::inspection_kind])) AND (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['inspection:handover'::text]) AS pools_with_any)::uuid[]))) OR ((kind <> ALL (ARRAY['handover'::inspection_kind, 'return'::inspection_kind])) AND (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['inspection:write'::text]) AS pools_with_any)::uuid[]))))
Policy For Using With check
insurance_claim_photos_insert insert (app.claim_pool(claim_id) = ANY (( SELECT app.pools_with_any(ARRAY['insurance:write'::text]) AS pools_with_any)::uuid[]))
insurance_claim_photos_read select (app.claim_pool(claim_id) = ANY (( SELECT app.pools_with_any(ARRAY['insurance:read'::text]) AS pools_with_any)::uuid[]))
insurance_claim_photos_update update ((app.claim_pool(claim_id) = ANY (( SELECT app.pools_with_any(ARRAY['insurance:write'::text]) AS pools_with_any)::uuid[])) AND (app.claim_pool(claim_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:write'::text]) AS pools_with_any)::uuid[]))) ((app.claim_pool(claim_id) = ANY (( SELECT app.pools_with_any(ARRAY['insurance:write'::text]) AS pools_with_any)::uuid[])) AND (app.claim_pool(claim_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:write'::text]) AS pools_with_any)::uuid[])))
Policy For Using With check
insurance_claims_insert insert (app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['insurance:write'::text]) AS pools_with_any)::uuid[]))
insurance_claims_read select (app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['insurance:read'::text]) AS pools_with_any)::uuid[]))
insurance_claims_update update (app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['insurance:write'::text]) AS pools_with_any)::uuid[])) (app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['insurance:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
insurance_policies_read select ((app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['insurance:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.vehicle_partner(vehicle_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
Policy For Using With check
insurer_garages_read select (organization_id = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))
Policy For Using With check
insurers_read select (organization_id = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))
Policy For Using With check
invitation_rental_companies_read select (app.invitation_pool(invitation_id) = ANY (( SELECT app.pools_with_any(ARRAY['user:read'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
invitations_read select (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['user:read'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
lead_sources_read select (organization_id = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))
Policy For Using With check
legal_entities_read select (organization_id = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))

No policies: app users can't read or change it.

Policy For Using With check
member_permission_overrides_read select (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['user:read'::text]) AS orgs_with_any)::uuid[]))
Policy For Using With check
member_rental_companies_read select (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['user:read'::text]) AS orgs_with_any)::uuid[]))
Policy For Using With check
member_roles_read select (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['user:read'::text]) AS orgs_with_any)::uuid[]))
Policy For Using With check
memberships_read select (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['user:read'::text]) AS orgs_with_any)::uuid[]))
Policy For Using With check
notification_preferences_read select (membership_id = ANY (( SELECT app.my_membership_ids() AS my_membership_ids)::uuid[]))
Policy For Using With check
notification_receipts_read select (membership_id = ANY (( SELECT app.my_membership_ids() AS my_membership_ids)::uuid[]))
Policy For Using With check
notification_types_read select true
Policy For Using With check
notifications_read select app.notification_seen(type_code, pool_id, recipient_membership_id)
Policy For Using With check
organization_settings_read select (organization_id = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))
Policy For Using With check
organizations_read select (id = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))
Policy For Using With check
payment_allocations_insert insert (app.payment_pool(payment_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:write'::text]) AS pools_with_any)::uuid[]))
payment_allocations_read select (app.payment_pool(payment_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:read'::text]) AS pools_with_any)::uuid[]))
payment_allocations_update update (app.payment_pool(payment_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:write'::text]) AS pools_with_any)::uuid[])) (app.payment_pool(payment_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
payments_insert insert (((voided_at IS NULL) AND (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:write'::text]) AS pools_with_any)::uuid[]))) OR ((voided_at IS NOT NULL) AND (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:approve'::text]) AS pools_with_any)::uuid[]))))
payments_read select (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:read'::text]) AS pools_with_any)::uuid[]))
payments_update update (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:write'::text, 'payment:approve'::text]) AS pools_with_any)::uuid[])) (((voided_at IS NULL) AND (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:write'::text]) AS pools_with_any)::uuid[]))) OR ((voided_at IS NOT NULL) AND (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:approve'::text]) AS pools_with_any)::uuid[]))))
Policy For Using With check
payouts_insert insert (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['payment:approve'::text]) AS orgs_with_any)::uuid[]))
payouts_read select ((organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['payment:read'::text]) AS orgs_with_any)::uuid[])) AND (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['payment:margin'::text]) AS orgs_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (rental_company_id = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
payouts_update update (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['payment:approve'::text]) AS orgs_with_any)::uuid[])) (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['payment:approve'::text]) AS orgs_with_any)::uuid[]))
Policy For Using With check
permissions_read select ((cardinality(( SELECT app.orgs_with('user:read'::text) AS orgs_with)) > 0) OR (code = ANY (( SELECT app.my_permission_codes() AS my_permission_codes)::text[])))
Policy For Using With check
pool_settings_read select (app.pool_org(pool_id) = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))
Policy For Using With check
pool_transfers_read select ((from_pool_id = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:read'::text, 'driver:read'::text]) AS pools_with_any)::uuid[])) OR (to_pool_id = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:read'::text, 'driver:read'::text]) AS pools_with_any)::uuid[])))
pool_transfers_update update ((from_pool_id = ANY (( SELECT app.pools_with_any(ARRAY['transfer:approve'::text]) AS pools_with_any)::uuid[])) OR (to_pool_id = ANY (( SELECT app.pools_with_any(ARRAY['transfer:approve'::text]) AS pools_with_any)::uuid[]))) ((from_pool_id = ANY (( SELECT app.pools_with_any(ARRAY['transfer:approve'::text]) AS pools_with_any)::uuid[])) OR (to_pool_id = ANY (( SELECT app.pools_with_any(ARRAY['transfer:approve'::text]) AS pools_with_any)::uuid[])))
Policy For Using With check
pools_read select (organization_id = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))
Policy For Using With check
pricing_groups_read select (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['master_data:read'::text]) AS orgs_with_any)::uuid[]))
Policy For Using With check
profiles_read select ((id = ( SELECT auth.uid() AS uid)) OR (app.profile_orgs(id) && ( SELECT app.orgs_with('user:read'::text) AS orgs_with)))
profiles_update update (app.profile_orgs(id) && ( SELECT app.orgs_with('user:write'::text) AS orgs_with)) (app.profile_orgs(id) && ( SELECT app.orgs_with('user:write'::text) AS orgs_with))
Policy For Using With check
queue_events_insert insert (app.queue_ticket_pool(ticket_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
queue_events_read select (app.queue_ticket_pool(ticket_id) = ANY (( SELECT app.pools_with_any(ARRAY['queue:read'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
queue_tickets_insert insert (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
queue_tickets_read select (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['queue:read'::text]) AS pools_with_any)::uuid[]))
queue_tickets_update update (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[])) (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['driver:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
rental_companies_read select ((organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['master_data:read'::text, 'payment:read'::text]) AS orgs_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (id = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
Policy For Using With check
rentals_insert insert (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['booking:write'::text, 'onboarding:write'::text, 'inspection:handover'::text]) AS pools_with_any)::uuid[]))
rentals_read select ((pool_id = ANY (( SELECT app.pools_with_any(ARRAY['onboarding:read'::text, 'booking:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.vehicle_partner(vehicle_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
rentals_update update (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['booking:write'::text, 'onboarding:write'::text, 'inspection:handover'::text]) AS pools_with_any)::uuid[])) (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['booking:write'::text, 'onboarding:write'::text, 'inspection:handover'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
repo_requests_read select ((app.rental_pool(rental_id) = ANY (( SELECT app.pools_with_any(ARRAY['repo:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.rental_partner(rental_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
Policy For Using With check
repo_work_order_pics_read select ((app.repo_work_order_pool(work_order_id) = ANY (( SELECT app.pools_with_any(ARRAY['repo:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR app.repo_work_order_has_my_partner(work_order_id)))
Policy For Using With check
repo_work_order_units_read select ((app.repo_work_order_pool(work_order_id) = ANY (( SELECT app.pools_with_any(ARRAY['repo:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.repo_request_partner(repo_request_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
Policy For Using With check
repo_work_orders_read select ((pool_id = ANY (( SELECT app.pools_with_any(ARRAY['repo:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR app.repo_work_order_has_my_partner(id)))
Policy For Using With check
role_permissions_delete delete ((app.role_org(role_id) = ANY (( SELECT app.orgs_with_any(ARRAY['user:write'::text]) AS orgs_with_any)::uuid[])) AND (NOT app.role_is_system(role_id)))
role_permissions_insert insert ((app.role_org(role_id) = ANY (( SELECT app.orgs_with_any(ARRAY['user:write'::text]) AS orgs_with_any)::uuid[])) AND (NOT app.role_is_system(role_id)))
role_permissions_read select (app.role_org(role_id) = ANY (( SELECT app.orgs_with_any(ARRAY['user:read'::text]) AS orgs_with_any)::uuid[]))
Policy For Using With check
roles_delete delete ((organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['user:write'::text]) AS orgs_with_any)::uuid[])) AND (NOT is_system))
roles_insert insert ((organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['user:write'::text]) AS orgs_with_any)::uuid[])) AND (NOT is_system))
roles_read select (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['user:read'::text]) AS orgs_with_any)::uuid[]))
roles_update update ((organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['user:write'::text]) AS orgs_with_any)::uuid[])) AND (NOT is_system)) ((organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['user:write'::text]) AS orgs_with_any)::uuid[])) AND (NOT is_system))
Policy For Using With check
stock_opname_expected_insert insert (app.opname_session_pool(session_id) = ANY (( SELECT app.pools_with_any(ARRAY['opname:write'::text]) AS pools_with_any)::uuid[]))
stock_opname_expected_read select (app.opname_session_pool(session_id) = ANY (( SELECT app.pools_with_any(ARRAY['opname:read'::text]) AS pools_with_any)::uuid[]))
stock_opname_expected_update update (app.opname_session_pool(session_id) = ANY (( SELECT app.pools_with_any(ARRAY['opname:write'::text]) AS pools_with_any)::uuid[])) (app.opname_session_pool(session_id) = ANY (( SELECT app.pools_with_any(ARRAY['opname:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
stock_opname_scans_insert insert (app.opname_session_pool(session_id) = ANY (( SELECT app.pools_with_any(ARRAY['opname:write'::text]) AS pools_with_any)::uuid[]))
stock_opname_scans_read select (app.opname_session_pool(session_id) = ANY (( SELECT app.pools_with_any(ARRAY['opname:read'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
stock_opname_sessions_insert insert (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['opname:write'::text]) AS pools_with_any)::uuid[]))
stock_opname_sessions_read select (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['opname:read'::text]) AS pools_with_any)::uuid[]))
stock_opname_sessions_update update (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['opname:write'::text]) AS pools_with_any)::uuid[])) (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['opname:write'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
subscriptions_read select (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['user:write'::text]) AS orgs_with_any)::uuid[]))
Policy For Using With check
temporary_plates_delete delete (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['master_data:write'::text]) AS orgs_with_any)::uuid[]))
temporary_plates_insert insert (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['master_data:write'::text]) AS orgs_with_any)::uuid[]))
temporary_plates_read select (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['vehicle:read'::text, 'master_data:read'::text]) AS orgs_with_any)::uuid[]))
temporary_plates_update update (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['master_data:write'::text]) AS orgs_with_any)::uuid[])) (organization_id = ANY (( SELECT app.orgs_with_any(ARRAY['master_data:write'::text]) AS orgs_with_any)::uuid[]))
Policy For Using With check
v1_files_read select (((v1_folder = ANY (ARRAY['bc'::text, 'driver'::text])) AND (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['driver:read'::text, 'screening:read'::text, 'onboarding:read'::text, 'booking:read'::text, 'payment:read'::text, 'inspection:read'::text, 'gate:read'::text, 'debt_letter:read'::text]) AS pools_with_any)::uuid[])) AND (organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[]))) OR ((v1_folder = ANY (ARRAY['payment'::text, 'rebate'::text])) AND (app.driver_pool(driver_id) = ANY (( SELECT app.pools_with_any(ARRAY['payment:read'::text]) AS pools_with_any)::uuid[]))) OR ((v1_folder = ANY (ARRAY['vehicle'::text, 'checkpoint'::text, 'asuransi'::text, 'etle'::text])) AND (app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:read'::text, 'gate:read'::text, 'fleet_monitor:read'::text, 'inspection:read'::text, 'work_order:read'::text, 'insurance:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.vehicle_partner(vehicle_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[])))))
Policy For Using With check
vehicle_brands_read select (organization_id = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))
Policy For Using With check
vehicle_documents_read select ((app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.vehicle_partner(vehicle_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
Policy For Using With check
vehicle_models_read select (organization_id = ANY (( SELECT app.my_org_ids() AS my_org_ids)::uuid[]))
Policy For Using With check
vehicle_photos_read select ((app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:read'::text, 'gate:read'::text, 'fleet_monitor:read'::text, 'inspection:read'::text, 'work_order:read'::text, 'insurance:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.vehicle_partner(vehicle_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
Policy For Using With check
vehicle_plate_history_read select (app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:read'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
vehicle_status_history_read select (app.vehicle_pool(vehicle_id) = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:read'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
vehicles_insert insert ((home_pool_id = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:write'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (rental_company_id = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
vehicles_read select ((home_pool_id = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:read'::text, 'gate:read'::text, 'fleet_monitor:read'::text, 'inspection:read'::text, 'work_order:read'::text, 'insurance:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (rental_company_id = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
vehicles_update update ((home_pool_id = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:write'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (rental_company_id = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[])))) ((home_pool_id = ANY (( SELECT app.pools_with_any(ARRAY['vehicle:write'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (rental_company_id = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
Policy For Using With check
work_order_events_insert insert (app.work_order_pool(work_order_id) = ANY (( SELECT app.pools_with_any(ARRAY['maintenance:write'::text]) AS pools_with_any)::uuid[]))
work_order_events_read select (app.work_order_pool(work_order_id) = ANY (( SELECT app.pools_with_any(ARRAY['work_order:read'::text]) AS pools_with_any)::uuid[]))
Policy For Using With check
work_orders_insert insert (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['maintenance:write'::text]) AS pools_with_any)::uuid[]))
work_orders_read select ((pool_id = ANY (( SELECT app.pools_with_any(ARRAY['work_order:read'::text]) AS pools_with_any)::uuid[])) AND ((organization_id <> ALL (( SELECT app.partner_limited_orgs() AS partner_limited_orgs)::uuid[])) OR (app.vehicle_partner(vehicle_id) = ANY (( SELECT app.my_partner_ids() AS my_partner_ids)::uuid[]))))
work_orders_update update (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['maintenance:write'::text]) AS pools_with_any)::uuid[])) (pool_id = ANY (( SELECT app.pools_with_any(ARRAY['maintenance:write'::text]) AS pools_with_any)::uuid[]))