Skip to content

Commit 7c5d1ca

Browse files
author
Ronald A Richardson
committed
fix: sync company_users to sandbox so invited users appear in IAM list
The IAM user list is queried against the sandbox database when the console is in sandbox mode. CompanyUser rows (created by acceptCompanyInvite) were only written to production, so invited users who had accepted were invisible to the UserFilter::queryForInternal() whereHas('companyUsers') check. Add CompanyUser to the SyncSandbox syncable models list so that membership rows are mirrored to sandbox on every hourly sync. Also add company_users to the --truncate block for consistency.
1 parent 0d4320c commit 7c5d1ca

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/Console/Commands/SyncSandbox.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,13 @@ public function handle()
5656
DB::connection('sandbox')
5757
->table('api_credentials')
5858
->truncate();
59+
DB::connection('sandbox')
60+
->table('company_users')
61+
->truncate();
5962
}
6063

6164
// Models that need to be synced from Production to Sandbox
62-
$syncable = [\Fleetbase\Models\User::class, \Fleetbase\Models\Company::class, \Fleetbase\Models\ApiCredential::class];
65+
$syncable = [\Fleetbase\Models\User::class, \Fleetbase\Models\Company::class, \Fleetbase\Models\CompanyUser::class, \Fleetbase\Models\ApiCredential::class];
6366

6467
// Sync each syncable data model
6568
foreach ($syncable as $model) {

0 commit comments

Comments
 (0)