CLI
Use this command for customer portal roles after a module adds features they should receive. Back-office staff roles use their own synchronization command.
yarn mercato customer_accounts sync-customer-role-acls merges each enabled module's setup.defaultCustomerRoleFeatures into the CustomerRoleAcl rows of the target tenant(s). It is the customer-portal counterpart of auth sync-role-acls: defaultCustomerRoleFeatures is otherwise merged during tenant setup only, so a tenant that already exists never receives portal features a module declares later.
The command lives in customer_accounts because that module owns the CustomerRole / CustomerRoleAcl entities and the merge helper both this command and seedDefaults call.
# Sync a single tenant (recommended)
yarn mercato customer_accounts sync-customer-role-acls --tenant <tenantId>
# Sync every tenant in the connected database
yarn mercato customer_accounts sync-customer-role-acls
| Flag | Default | Meaning |
|---|---|---|
--tenant <id> | none – iterates every tenant | Restrict the sync to one tenant. Accepts --tenantId and --tenant_id as aliases. |
defaultCustomerRoleFeatures from every enabled module (via getCliModules()), keyed by customer role slug.CustomerRole rows, then that role's CustomerRoleAcl.portal.* (or *) does not gain a redundant concrete grant.tenantId, and the write set for one tenant can never reach another.Nothing to do — N tenant(s) already in sync. when there is nothing to write.workflows module's portal.tasks.view / portal.tasks.complete. Existing tenants receive them only after this command runs.portal_admin / buyer / viewer (or your module's custom slugs) already exist; roles are created by customer_accounts onTenantCreated / seedDefaults, or by the module that owns them.auth sync-role-acls – that command syncs staff RoleAcl rows; this one syncs customer CustomerRoleAcl rows. They target different identity systems.❌ No CLI modules registered. Run \yarn generate` first.` – regenerate the module aggregation files.❌ Invalid --tenant value: … – the value was empty or whitespace. Pass a UUID from yarn mercato auth list-tenants.❌ Tenant not found: … – no Tenant row with that id; nothing was written.CustomerRbacService caches resolved ACLs for five minutes; wait for the TTL or have the user re-authenticate.auth sync-role-acls – the staff-role counterpart.