fix(rbac/mail): migrate legacy is_admin users to Owner in-migration; send maintenance mail in customer locale
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>feat/portal-design
parent
eff8c08258
commit
d68d8e1f25
|
|
@ -129,7 +129,9 @@ class Maintenance extends Component
|
|||
['email' => $customer->email],
|
||||
);
|
||||
if ($delivery->wasRecentlyCreated) {
|
||||
Mail::to($customer->email)->queue(new MaintenanceAnnouncementMail($window, $customer));
|
||||
Mail::to($customer->email)
|
||||
->locale($customer->locale ?: config('app.locale'))
|
||||
->queue(new MaintenanceAnnouncementMail($window, $customer));
|
||||
$delivery->update(['sent_at' => now()]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
|
@ -44,6 +45,14 @@ return new class extends Migration
|
|||
Role::findOrCreate($roleName, 'web')->syncPermissions($perms);
|
||||
}
|
||||
|
||||
// Migrate existing operators BEFORE the gate switches to console.view:
|
||||
// every legacy is_admin user becomes an Owner so none are locked out.
|
||||
User::query()->where('is_admin', true)->get()->each(function (User $u) {
|
||||
if (! $u->hasAnyRole(User::OPERATOR_ROLES)) {
|
||||
$u->assignRole('Owner');
|
||||
}
|
||||
});
|
||||
|
||||
app(PermissionRegistrar::class)->forgetCachedPermissions();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue