refactor(support): consolidate remaining ID normalization via toIntIds()
Extends the toIntIds() rollout to service and repository layers: - Drops a third private duplicate (UserCustomFieldValueService::normalizeTenantIds) - Collapses the two-line intval+filter pattern inside UserAssignmentService, UserAuthorizationPolicy, SsoUserLinkService, DepartmentService, and UserCustomFieldValueService - Replaces inline patterns in 4 repositories (RolePermissionRepository, RoleAssignableRoleRepository, UserWriteRepository, DepartmentRepository, UserCustomFieldValueRepository, UserCustomFieldValueOptionRepository) - Simplifies the notifications sanitizeTenantIds trait body Tenant-area files deliberately untouched per parallel ongoing work on the tenant-logo refactor. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -377,7 +377,7 @@ class SsoUserLinkService
|
||||
|
||||
private function ensureTenantAssignment(int $userId, int $tenantId): void
|
||||
{
|
||||
$tenantIds = array_values(array_unique(array_map('intval', $this->userTenantRepository->listTenantIdsByUserId($userId))));
|
||||
$tenantIds = toIntIds($this->userTenantRepository->listTenantIdsByUserId($userId));
|
||||
if (!in_array($tenantId, $tenantIds, true)) {
|
||||
$tenantIds[] = $tenantId;
|
||||
$this->userAssignmentService->syncTenants($userId, $tenantIds);
|
||||
|
||||
Reference in New Issue
Block a user