GOAL ships three APPLICATION global role templates in permissions__roles. They are copied into company_roles (with permissions) for each transactional company (type = T).
Template code |
Purpose |
|---|---|
COMPANY_ADMIN |
All active GOAL_V2_% permissions on the global template (company role inherits on provision) |
COMPANY_ROLE_MANAGER |
Manage company roles, provision/sync from global, assign users to company roles |
COMPANY_ROLE_VIEWER |
Read-only on company roles and assignments |
Catalog source: goal-backend/config/company_role_bootstrap.php
No new REST endpoint — auto-bootstrap runs on company create; backfill uses Artisan only.
composer sync-permissions (ensure permissions rows exist, regenerate enums, and merge COMPANY_ADMIN grants on every active transactional company).2026_11_13_160000_seed_company_role_bootstrap_global_templates).php artisan company-roles:bootstrap-defaults --sync-templates --all-transactional --only-missing
| Variable | Default | Description |
|---|---|---|
GOAL_BOOTSTRAP_COMPANY_ROLES_ON_CREATE |
true |
Provision defaults when creating a transactional company via API |
GOAL_BOOTSTRAP_COMPANY_ROLES_REPORT_IN_RESPONSE |
false |
Include bootstrap object in company create response when successful |
composer sync-permissions ends with:
php artisan company-roles:sync-admin-permissions --company=*
This refreshes the global COMPANY_ADMIN template (all active GOAL_V2_%) and merges missing grants into each company's admin role (source_role_id or code = COMPANY_ADMIN). Set GOAL_SYNC_COMPANY_ADMIN_AFTER_PERMISSION_CATALOG=false to skip this step in CI/local runs.
php artisan company-roles:sync-admin-permissions --company=12 --dry-run
php artisan company-roles:bootstrap-defaults [options]
| Option | Description |
|---|---|
--company=* |
One or more company IDs |
--all-transactional |
All active companies with type = T |
--only-missing |
Skip companies that already have all three bootstrap roles |
--dry-run |
Resolve templates and report missing role codes without writes |
--sync-templates |
Re-run global template upsert from config before provisioning |
--assigned-by= |
User ID stored on permission assignment audit fields |
# New company after manual template fix
php artisan company-roles:bootstrap-defaults --sync-templates --company=12
# Production backfill (idempotent)
php artisan company-roles:bootstrap-defaults --all-transactional --only-missing
# Preview
php artisan company-roles:bootstrap-defaults --company=12 --dry-run
POST /api/v1/backend/base/master/companies (transactional company):
replicateToGoalDatabase, backend calls BootstrapCompanyDefaultRolesAction.COMPANY_ADMIN.Company maintenance APIs still require: Authorization: Bearer <token>, x-app-stage, x-app-uid, and companyId where applicable.