Open MercatoDocsSearch docsAPI reference

CLI

mercato auth sync-role-acls

After enabling a module, the routes may exist while existing roles still lack its features. Synchronize the default feature assignments, then check access with the intended role.

yarn mercato auth sync-role-acls merges each enabled module's setup.defaultRoleFeatures into the RoleAcl rows of the target tenant(s). It is the recovery command when a tenant's role ACLs have drifted – for example, after a demo user detached features from admin, or after a module upgrade introduced new features that were never propagated to pre-existing tenants.

Usage

# Sync a single tenant (recommended)
yarn mercato auth sync-role-acls --tenant <tenantId>

# Sync every tenant in the connected database
yarn mercato auth sync-role-acls

# Skip the superadmin role (defensive — superadmin grants isSuperAdmin)
yarn mercato auth sync-role-acls --tenant <tenantId> --no-superadmin

Flags

FlagDefaultMeaning
--tenant <id>none – iterates every tenantRestrict the sync to one tenant. Accepts --tenantId and --tenant_id as aliases.
--no-superadminoff (superadmin is synced)Skip writing the superadmin role ACL. Use when you do not want to touch isSuperAdmin on the target tenant.

Behavior

When to Run

When NOT to Use

Troubleshooting

Previous: mercato auth setup · Next: mercato configs cache