fix(004): Improve permission status badges readability
Changes: - Status labels: 'ok' → 'granted' (clearer meaning) - Badge colors: granted=green, missing=orange, error=red - Updated tests to match new status values This makes the permission status more intuitive and visually distinguishable on the Tenant detail page (/admin/tenants/1).
This commit is contained in:
parent
bf9bb77562
commit
a25d413d79
@ -281,7 +281,13 @@ public static function infolist(Schema $schema): Schema
|
|||||||
->label('Features')
|
->label('Features')
|
||||||
->formatStateUsing(fn ($state) => is_array($state) ? implode(', ', $state) : (string) $state),
|
->formatStateUsing(fn ($state) => is_array($state) ? implode(', ', $state) : (string) $state),
|
||||||
Infolists\Components\TextEntry::make('status')
|
Infolists\Components\TextEntry::make('status')
|
||||||
->badge(),
|
->badge()
|
||||||
|
->color(fn (string $state): string => match ($state) {
|
||||||
|
'granted' => 'success',
|
||||||
|
'missing' => 'warning',
|
||||||
|
'error' => 'danger',
|
||||||
|
default => 'gray',
|
||||||
|
}),
|
||||||
])
|
])
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
]);
|
]);
|
||||||
@ -908,7 +914,7 @@ public static function verifyTenant(
|
|||||||
actorEmail: $user?->email,
|
actorEmail: $user?->email,
|
||||||
actorName: $user?->name,
|
actorName: $user?->name,
|
||||||
status: match ($permissions['overall_status']) {
|
status: match ($permissions['overall_status']) {
|
||||||
'ok' => 'success',
|
'granted' => 'success',
|
||||||
'error' => 'error',
|
'error' => 'error',
|
||||||
default => 'partial',
|
default => 'partial',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -105,7 +105,7 @@ public function compare(Tenant $tenant, ?array $grantedStatuses = null, bool $pe
|
|||||||
$overall = match (true) {
|
$overall = match (true) {
|
||||||
$hasErrors => 'error',
|
$hasErrors => 'error',
|
||||||
$hasMissing => 'missing',
|
$hasMissing => 'missing',
|
||||||
default => 'ok',
|
default => 'granted',
|
||||||
};
|
};
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@ -148,7 +148,7 @@ public function configuredGrantedStatuses(): array
|
|||||||
|
|
||||||
foreach ($configured as $key) {
|
foreach ($configured as $key) {
|
||||||
$normalized[$key] = [
|
$normalized[$key] = [
|
||||||
'status' => 'ok',
|
'status' => 'granted',
|
||||||
'details' => ['source' => 'configured'],
|
'details' => ['source' => 'configured'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ private function fetchLivePermissions(Tenant $tenant): array
|
|||||||
|
|
||||||
foreach ($grantedPermissions as $permission) {
|
foreach ($grantedPermissions as $permission) {
|
||||||
$normalized[$permission] = [
|
$normalized[$permission] = [
|
||||||
'status' => 'ok',
|
'status' => 'granted',
|
||||||
'details' => ['source' => 'graph_api', 'checked_at' => now()->toIso8601String()],
|
'details' => ['source' => 'graph_api', 'checked_at' => now()->toIso8601String()],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -104,8 +104,10 @@
|
|||||||
'Policy.ReadWrite.ConditionalAccess',
|
'Policy.ReadWrite.ConditionalAccess',
|
||||||
|
|
||||||
// Feature 004 - Assignments & Scope Tags (NEU seit 2025-12-22):
|
// Feature 004 - Assignments & Scope Tags (NEU seit 2025-12-22):
|
||||||
// TODO: Nach Azure AD Setup verschieben nach "Tatsächlich granted"
|
// Diese Berechtigungen MÜSSEN in Azure AD hinzugefügt werden!
|
||||||
'DeviceManagementRBAC.Read.All', // Scope Tag Namen auflösen
|
// Status wird als "missing" angezeigt, bis sie granted sind.
|
||||||
'Group.Read.All', // Group Namen für Assignments auflösen
|
// Nach dem Hinzufügen: Verschiebe diese nach "Tatsächlich granted" (oben)
|
||||||
|
// 'DeviceManagementRBAC.Read.All', // → Noch nicht granted
|
||||||
|
// 'Group.Read.All', // → Noch nicht granted
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -42,14 +42,14 @@ function requiredPermissions(): array
|
|||||||
TenantPermission::create([
|
TenantPermission::create([
|
||||||
'tenant_id' => $tenant->id,
|
'tenant_id' => $tenant->id,
|
||||||
'permission_key' => $permission['key'],
|
'permission_key' => $permission['key'],
|
||||||
'status' => 'ok',
|
'status' => 'granted',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = app(TenantPermissionService::class)->compare($tenant);
|
$result = app(TenantPermissionService::class)->compare($tenant);
|
||||||
|
|
||||||
expect($result['overall_status'])->toBe('ok');
|
expect($result['overall_status'])->toBe('granted');
|
||||||
expect(TenantPermission::where('tenant_id', $tenant->id)->where('status', 'ok')->count())
|
expect(TenantPermission::where('tenant_id', $tenant->id)->where('status', 'granted')->count())
|
||||||
->toBe(count(requiredPermissions()));
|
->toBe(count(requiredPermissions()));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user