Cashiers collect via Billing only; strip POS from demo staff grants and StaffUx/launcher so the suite hub no longer offers POS for that role. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -74,16 +74,43 @@ class AppServiceProvider extends ServiceProvider
|
||||
|
||||
View::composer(['partials.launcher', 'partials.topbar-desktop-widgets', 'components.app-layout'], function () {
|
||||
$user = auth()->user();
|
||||
if (! $user || session()->has(\App\Support\StaffUx::SESSION_KEY)) {
|
||||
if (! $user) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$access = app(\App\Services\Identity\IdentityTeamClient::class)
|
||||
->appAccess($user->ownerRef());
|
||||
\App\Support\StaffUx::remember($access);
|
||||
} catch (\Throwable) {
|
||||
// Leave fail-open defaults until Identity is available.
|
||||
$member = app(\App\Services\Care\OrganizationResolver::class)->memberFor($user);
|
||||
$permissions = app(\App\Services\Care\CarePermissions::class);
|
||||
|
||||
if (! session()->has(\App\Support\StaffUx::SESSION_KEY)) {
|
||||
try {
|
||||
$access = app(\App\Services\Identity\IdentityTeamClient::class)
|
||||
->appAccess($user->ownerRef());
|
||||
\App\Support\StaffUx::remember(
|
||||
$permissions->filterStaffAppAccess($member, $access)
|
||||
);
|
||||
} catch (\Throwable) {
|
||||
// Leave fail-open defaults until Identity is available.
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Stale Identity grants may still list POS — strip for Care cashiers.
|
||||
$cached = session(\App\Support\StaffUx::SESSION_KEY);
|
||||
if (! is_array($cached) || ! empty($cached['full_access'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$filtered = $permissions->filterStaffAppAccess($member, [
|
||||
'full_access' => false,
|
||||
'apps' => array_values(array_map('strval', (array) ($cached['apps'] ?? []))),
|
||||
'show_hub' => (bool) ($cached['show_hub'] ?? false),
|
||||
'show_billing' => (bool) ($cached['show_billing'] ?? false),
|
||||
]);
|
||||
|
||||
if ($filtered['apps'] !== array_values(array_map('strval', (array) ($cached['apps'] ?? [])))
|
||||
|| (bool) ($filtered['show_hub'] ?? false) !== (bool) ($cached['show_hub'] ?? false)) {
|
||||
\App\Support\StaffUx::remember($filtered);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user