getUser(); if (!$user instanceof UserInterface) { return false; } if (in_array(UserGroupPermissions::ROLE_SUPER_ADMIN, $user->getRoles())) { return true; } if ($attribute === 'CLIENT_VIEW') { foreach ($user->getAllowedOrganizationalUnits() as $allowedOrganizationalUnit) { if ($allowedOrganizationalUnit->getId() === $subject->getOrganizationalUnit()->getEntity()->getId()) { return true; } } } return false; } }