mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: if a domain is deleted, it must be updated
This commit is contained in:
@@ -161,29 +161,38 @@ class WatchListController extends AbstractController
|
|||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
if (null !== $connector) {
|
if (null === $connector) {
|
||||||
if (!$user->getConnectors()->contains($connector)) {
|
return;
|
||||||
$this->logger->notice('The Connector ({connector}) does not belong to the user.', [
|
}
|
||||||
'username' => $user->getUserIdentifier(),
|
if (!$user->getConnectors()->contains($connector)) {
|
||||||
'connector' => $connector->getId(),
|
$this->logger->notice('The Connector ({connector}) does not belong to the user.', [
|
||||||
]);
|
'username' => $user->getUserIdentifier(),
|
||||||
throw new AccessDeniedHttpException('You cannot create a Watchlist with a connector that does not belong to you');
|
'connector' => $connector->getId(),
|
||||||
|
]);
|
||||||
|
throw new AccessDeniedHttpException('You cannot create a Watchlist with a connector that does not belong to you');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var Domain $domain */
|
||||||
|
foreach ($watchList->getDomains()->getIterator() as $domain) {
|
||||||
|
if ($domain->getDeleted()) {
|
||||||
|
$ldhName = $domain->getLdhName();
|
||||||
|
throw new BadRequestHttpException("To add a connector, no domain in this Watchlist must have already expired ($ldhName)");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$connectorProviderClass = $connector->getProvider()->getConnectorProvider();
|
$connectorProviderClass = $connector->getProvider()->getConnectorProvider();
|
||||||
/** @var AbstractProvider $connectorProvider */
|
/** @var AbstractProvider $connectorProvider */
|
||||||
$connectorProvider = new $connectorProviderClass($connector->getAuthData(), $this->httpClient, $this->cacheItemPool, $this->kernel);
|
$connectorProvider = new $connectorProviderClass($connector->getAuthData(), $this->httpClient, $this->cacheItemPool, $this->kernel);
|
||||||
|
|
||||||
$connectorProvider::verifyAuthData($connector->getAuthData(), $this->httpClient); // We want to check if the tokens are OK
|
$connectorProvider::verifyAuthData($connector->getAuthData(), $this->httpClient); // We want to check if the tokens are OK
|
||||||
$supported = $connectorProvider->isSupported(...$watchList->getDomains()->toArray());
|
$supported = $connectorProvider->isSupported(...$watchList->getDomains()->toArray());
|
||||||
|
|
||||||
if (!$supported) {
|
if (!$supported) {
|
||||||
$this->logger->notice('The Connector ({connector}) does not support all TLDs in this Watchlist', [
|
$this->logger->notice('The Connector ({connector}) does not support all TLDs in this Watchlist', [
|
||||||
'username' => $user->getUserIdentifier(),
|
'username' => $user->getUserIdentifier(),
|
||||||
'connector' => $connector->getId(),
|
'connector' => $connector->getId(),
|
||||||
]);
|
]);
|
||||||
throw new BadRequestHttpException('This connector does not support all TLDs in this Watchlist');
|
throw new BadRequestHttpException('This connector does not support all TLDs in this Watchlist');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ readonly class RDAPService
|
|||||||
public static function isToBeWatchClosely(Domain $domain): bool
|
public static function isToBeWatchClosely(Domain $domain): bool
|
||||||
{
|
{
|
||||||
$status = $domain->getStatus();
|
$status = $domain->getStatus();
|
||||||
if (!empty($status) && count(array_intersect($status, self::IMPORTANT_STATUS))) {
|
if ((!empty($status) && count(array_intersect($status, self::IMPORTANT_STATUS))) || $domain->getDeleted()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user