2026-02-04 23:31:53 +01:00
|
|
|
<?php
|
|
|
|
|
|
2026-02-24 08:49:40 +01:00
|
|
|
use MintyPHP\Service\Access\RoleAuthorizationPolicy;
|
2026-02-23 12:58:19 +01:00
|
|
|
use MintyPHP\Support\Guard;
|
2026-02-04 23:31:53 +01:00
|
|
|
|
|
|
|
|
Guard::requireLogin();
|
2026-03-04 15:56:58 +01:00
|
|
|
gridRequireGetRequest();
|
2026-02-24 08:49:40 +01:00
|
|
|
|
2026-03-04 15:56:58 +01:00
|
|
|
Guard::requireAbilityOrForbidden(RoleAuthorizationPolicy::ABILITY_ADMIN_ROLES_VIEW);
|
2026-02-04 23:31:53 +01:00
|
|
|
|
2026-03-04 15:56:58 +01:00
|
|
|
$filters = gridParseFiltersFromSchemaFile(__DIR__ . '/filter-schema.php');
|
2026-02-04 23:31:53 +01:00
|
|
|
|
2026-03-04 15:56:58 +01:00
|
|
|
$result = app(\MintyPHP\Service\Access\RoleService::class)->listPaged([
|
|
|
|
|
'limit' => $filters['limit'],
|
|
|
|
|
'offset' => $filters['offset'],
|
|
|
|
|
'search' => $filters['search'],
|
|
|
|
|
'order' => $filters['order'],
|
|
|
|
|
'dir' => $filters['dir'],
|
|
|
|
|
'active' => $filters['active'],
|
2026-02-04 23:31:53 +01:00
|
|
|
]);
|
|
|
|
|
|
2026-03-06 00:44:52 +01:00
|
|
|
$settingsDefaultsGateway = app(\MintyPHP\Service\Settings\SettingsDefaultsGateway::class);
|
|
|
|
|
$defaultRoleId = $settingsDefaultsGateway->getDefaultRoleId();
|
2026-03-04 15:56:58 +01:00
|
|
|
$rolePermissionRepository = app(\MintyPHP\Repository\Access\RolePermissionRepository::class);
|
|
|
|
|
$userRoleRepository = app(\MintyPHP\Repository\Access\UserRoleRepository::class);
|
2026-03-13 12:05:11 +01:00
|
|
|
$userCounts = app(\MintyPHP\Service\Data\GridUserCountEnricher::class)->computeCounts(
|
|
|
|
|
$result['rows'],
|
|
|
|
|
$userRoleRepository->countUsersByRoleIds(...),
|
|
|
|
|
$userRoleRepository->countActiveUsersByRoleIds(...)
|
|
|
|
|
);
|
|
|
|
|
$rolePermissionCounts = $rolePermissionRepository->countPermissionsByRoleIds(array_keys($userCounts));
|
add composer-unused, comprehensive docs, and project restructure
- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks
- Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists
- Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services
- Add Microsoft OIDC SSO, API token management, and user lifecycle features
- Add swagger-ui vendor integration and OpenAPI spec
- Add production Docker setup and bin/ scripts
- Update composer dependencies, config, templates, and frontend assets throughout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:27:35 +01:00
|
|
|
|
2026-02-04 23:31:53 +01:00
|
|
|
$rows = [];
|
|
|
|
|
foreach ($result['rows'] as $row) {
|
|
|
|
|
$roleId = (int) ($row['id'] ?? 0);
|
2026-03-13 12:05:11 +01:00
|
|
|
$counts = $userCounts[$roleId] ?? ['active_users' => 0, 'inactive_users' => 0];
|
2026-02-04 23:31:53 +01:00
|
|
|
$rows[] = [
|
|
|
|
|
'id' => $row['id'] ?? null,
|
|
|
|
|
'uuid' => $row['uuid'] ?? '',
|
|
|
|
|
'is_default' => $roleId > 0 && $defaultRoleId === $roleId,
|
|
|
|
|
'description' => $row['description'] ?? '',
|
2026-02-11 19:28:12 +01:00
|
|
|
'code' => $row['code'] ?? '',
|
|
|
|
|
'active' => (int) ($row['active'] ?? 1),
|
2026-03-13 12:05:11 +01:00
|
|
|
'active_users' => $counts['active_users'],
|
|
|
|
|
'inactive_users' => $counts['inactive_users'],
|
add composer-unused, comprehensive docs, and project restructure
- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks
- Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists
- Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services
- Add Microsoft OIDC SSO, API token management, and user lifecycle features
- Add swagger-ui vendor integration and OpenAPI spec
- Add production Docker setup and bin/ scripts
- Update composer dependencies, config, templates, and frontend assets throughout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:27:35 +01:00
|
|
|
'permission_count' => (int) ($rolePermissionCounts[$roleId] ?? 0),
|
2026-02-04 23:31:53 +01:00
|
|
|
'created' => dt($row['created'] ?? ''),
|
|
|
|
|
'modified' => dt($row['modified'] ?? ''),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-04 15:56:58 +01:00
|
|
|
gridJsonDataResult($rows, (int) ($result['total'] ?? 0));
|