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:
2026-04-24 19:18:45 +02:00
parent 6c99c040b2
commit 1c779b8eeb
12 changed files with 23 additions and 54 deletions

View File

@@ -409,9 +409,7 @@ class UserAuthorizationPolicy implements AuthorizationPolicyInterface
'can_view_security_artifacts' => $isOwnAccount || $canViewUserAudit,
'can_view_permissions_table' => $this->hasPermission($actorUserId, PermissionService::PERMISSIONS_VIEW),
'is_own_account' => $isOwnAccount,
'allowed_tenant_ids' => is_array($allowedTenantIds)
? array_values(array_unique(array_map('intval', $allowedTenantIds)))
: null,
'allowed_tenant_ids' => is_array($allowedTenantIds) ? toIntIds($allowedTenantIds) : null,
];
return AuthorizationDecision::allow(['capabilities' => $capabilities]);