. */ declare(strict_types=1); namespace App\Services\InfoProviderSystem; use App\Entity\UserSystem\User; use Symfony\Bundle\SecurityBundle\Security; final readonly class CreateFromUrlHelper { public function __construct(private Security $security, private ProviderRegistry $providerRegistry) { } /** * Checks if at least one provider can create parts from an URL and the current user is allowed to use it. * This is used to determine if the "From URL" feature should be shown to the user. * @return bool */ public function canCreateFromUrl(): bool { if (!$this->security->isGranted('@info_providers.create_parts')) { return false; } //Check if either the generic web provider or the ai web provider is active $genericWebProvider = $this->providerRegistry->getProviderByKey('generic_web'); $aiWebProvider = $this->providerRegistry->getProviderByKey('ai_web'); return $genericWebProvider->isActive() || $aiWebProvider->isActive(); } }