✨ feat(Website): Ajoute WebsiteDns et WebsiteKey à l'entité Website.
✨ feat(Website): Crée une clé API et DNS principal lors de la création. 🔒 fix(ApiSubscriber): Valide le header EsyWebDns pour l'accès API. ✨ feat(ServerCard): Met à jour l'affichage des métriques serveur. ✨ feat(StatusController): Ajoute un endpoint pour vérifier l'état du site. 🐛 fix(CustomerController): Corrige une faute de frappe dans un flash message.
This commit is contained in:
@@ -33,9 +33,9 @@ export class ServerCard extends HTMLDivElement{
|
||||
}
|
||||
if(topic == "server/"+this.getAttribute('id')+"/metric") {
|
||||
let json = JSON.parse(message.toString());
|
||||
|
||||
this.cpu.querySelector('.p').innerText = json.cpu + "%";
|
||||
this.cpu.querySelector('.gauge >div').style.width = json.cpu + "%";
|
||||
|
||||
if (json.cpu <= 70) {
|
||||
this.cpu.querySelector('.gauge >div').classList = "bg-green-500 h-2 rounded-l-full";
|
||||
}
|
||||
@@ -45,9 +45,9 @@ export class ServerCard extends HTMLDivElement{
|
||||
if (json.cpu>=91) {
|
||||
this.cpu.querySelector('.gauge >div').classList = "bg-red-500 h-2 rounded-l-full";
|
||||
}
|
||||
|
||||
this.ram.querySelector('.p').innerText = json.memory + "%";
|
||||
this.ram.querySelector('.gauge >div').style.width = json.memory + "%";
|
||||
|
||||
if (json.memory <= 70) {
|
||||
this.ram.querySelector('.gauge >div').classList = "bg-green-500 h-2 rounded-l-full";
|
||||
}
|
||||
@@ -57,9 +57,9 @@ export class ServerCard extends HTMLDivElement{
|
||||
if (json.ram>=91) {
|
||||
this.ram.querySelector('.gauge >div').classList = "bg-red-500 h-2 rounded-l-full";
|
||||
}
|
||||
|
||||
this.hdd.querySelector('.p').innerText = json.disk + "%";
|
||||
this.hdd.querySelector('.gauge >div').style.width = json.disk + "%";
|
||||
|
||||
if (json.disk <= 70) {
|
||||
this.hdd.querySelector('.gauge >div').classList = "bg-green-500 h-2 rounded-l-full";
|
||||
}
|
||||
|
||||
35
migrations/Version20251111130711.php
Normal file
35
migrations/Version20251111130711.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20251111130711 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE website_key (id SERIAL NOT NULL, website_id INT DEFAULT NULL, type VARCHAR(255) NOT NULL, api_key VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_E2EAD56A18F45C82 ON website_key (website_id)');
|
||||
$this->addSql('ALTER TABLE website_key ADD CONSTRAINT FK_E2EAD56A18F45C82 FOREIGN KEY (website_id) REFERENCES website (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE website_key DROP CONSTRAINT FK_E2EAD56A18F45C82');
|
||||
$this->addSql('DROP TABLE website_key');
|
||||
}
|
||||
}
|
||||
38
migrations/Version20251111131037.php
Normal file
38
migrations/Version20251111131037.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20251111131037 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE website_dns (id SERIAL NOT NULL, website_id INT DEFAULT NULL, customer_dns_id INT DEFAULT NULL, is_main BOOLEAN NOT NULL, dns VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_EA97A28218F45C82 ON website_dns (website_id)');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_EA97A28255EAEAC2 ON website_dns (customer_dns_id)');
|
||||
$this->addSql('ALTER TABLE website_dns ADD CONSTRAINT FK_EA97A28218F45C82 FOREIGN KEY (website_id) REFERENCES website (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE website_dns ADD CONSTRAINT FK_EA97A28255EAEAC2 FOREIGN KEY (customer_dns_id) REFERENCES customer_dns (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE website_dns DROP CONSTRAINT FK_EA97A28218F45C82');
|
||||
$this->addSql('ALTER TABLE website_dns DROP CONSTRAINT FK_EA97A28255EAEAC2');
|
||||
$this->addSql('DROP TABLE website_dns');
|
||||
}
|
||||
}
|
||||
42
migrations/Version20251111131514.php
Normal file
42
migrations/Version20251111131514.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20251111131514 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE customer_dns DROP CONSTRAINT fk_cd1e82b718f45c82');
|
||||
$this->addSql('DROP INDEX idx_cd1e82b718f45c82');
|
||||
$this->addSql('ALTER TABLE customer_dns DROP website_id');
|
||||
$this->addSql('ALTER TABLE website_dns DROP CONSTRAINT fk_ea97a28255eaeac2');
|
||||
$this->addSql('DROP INDEX uniq_ea97a28255eaeac2');
|
||||
$this->addSql('ALTER TABLE website_dns DROP customer_dns_id');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE website_dns ADD customer_dns_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE website_dns ADD CONSTRAINT fk_ea97a28255eaeac2 FOREIGN KEY (customer_dns_id) REFERENCES customer_dns (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE UNIQUE INDEX uniq_ea97a28255eaeac2 ON website_dns (customer_dns_id)');
|
||||
$this->addSql('ALTER TABLE customer_dns ADD website_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE customer_dns ADD CONSTRAINT fk_cd1e82b718f45c82 FOREIGN KEY (website_id) REFERENCES website (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX idx_cd1e82b718f45c82 ON customer_dns (website_id)');
|
||||
}
|
||||
}
|
||||
36
migrations/Version20251111131648.php
Normal file
36
migrations/Version20251111131648.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20251111131648 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE website_dns DROP CONSTRAINT fk_ea97a28218f45c82');
|
||||
$this->addSql('DROP INDEX idx_ea97a28218f45c82');
|
||||
$this->addSql('ALTER TABLE website_dns DROP website_id');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE website_dns ADD website_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE website_dns ADD CONSTRAINT fk_ea97a28218f45c82 FOREIGN KEY (website_id) REFERENCES website (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX idx_ea97a28218f45c82 ON website_dns (website_id)');
|
||||
}
|
||||
}
|
||||
36
migrations/Version20251111131734.php
Normal file
36
migrations/Version20251111131734.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20251111131734 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE website_key DROP CONSTRAINT fk_e2ead56a18f45c82');
|
||||
$this->addSql('DROP INDEX idx_e2ead56a18f45c82');
|
||||
$this->addSql('ALTER TABLE website_key DROP website_id');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE website_key ADD website_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE website_key ADD CONSTRAINT fk_e2ead56a18f45c82 FOREIGN KEY (website_id) REFERENCES website (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX idx_e2ead56a18f45c82 ON website_key (website_id)');
|
||||
}
|
||||
}
|
||||
36
migrations/Version20251111132611.php
Normal file
36
migrations/Version20251111132611.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20251111132611 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE website_dns ADD website_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE website_dns ADD CONSTRAINT FK_EA97A28218F45C82 FOREIGN KEY (website_id) REFERENCES website (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_EA97A28218F45C82 ON website_dns (website_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE website_dns DROP CONSTRAINT FK_EA97A28218F45C82');
|
||||
$this->addSql('DROP INDEX IDX_EA97A28218F45C82');
|
||||
$this->addSql('ALTER TABLE website_dns DROP website_id');
|
||||
}
|
||||
}
|
||||
36
migrations/Version20251111133221.php
Normal file
36
migrations/Version20251111133221.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20251111133221 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE website_key ADD websitre_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE website_key ADD CONSTRAINT FK_E2EAD56A436DE8A4 FOREIGN KEY (websitre_id) REFERENCES website (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_E2EAD56A436DE8A4 ON website_key (websitre_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE website_key DROP CONSTRAINT FK_E2EAD56A436DE8A4');
|
||||
$this->addSql('DROP INDEX IDX_E2EAD56A436DE8A4');
|
||||
$this->addSql('ALTER TABLE website_key DROP websitre_id');
|
||||
}
|
||||
}
|
||||
36
migrations/Version20251111133332.php
Normal file
36
migrations/Version20251111133332.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20251111133332 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE website_dns ADD customer_dns_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE website_dns ADD CONSTRAINT FK_EA97A28255EAEAC2 FOREIGN KEY (customer_dns_id) REFERENCES customer_dns (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_EA97A28255EAEAC2 ON website_dns (customer_dns_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE website_dns DROP CONSTRAINT FK_EA97A28255EAEAC2');
|
||||
$this->addSql('DROP INDEX UNIQ_EA97A28255EAEAC2');
|
||||
$this->addSql('ALTER TABLE website_dns DROP customer_dns_id');
|
||||
}
|
||||
}
|
||||
36
src/Controller/Api/Private/EsyWeb/StatusController.php
Normal file
36
src/Controller/Api/Private/EsyWeb/StatusController.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Api\Private\EsyWeb;
|
||||
|
||||
use App\Entity\EsyWeb\WebsiteDns;
|
||||
use App\Repository\ComputeRepository;
|
||||
use App\Repository\EsyWeb\WebsiteDnsRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class StatusController extends AbstractController
|
||||
{
|
||||
#[Route('/api/private/esyweb/status', name: 'api_private_esyweb_status', methods: ['GET'])]
|
||||
public function status(Request $request,WebsiteDnsRepository $websiteDnsRepository)
|
||||
{
|
||||
$dns = $request->headers->get('EsyWebDns','');
|
||||
if($dns == "")
|
||||
return $this->json([
|
||||
'status' => 'unkown'
|
||||
],Response::HTTP_BAD_REQUEST);
|
||||
|
||||
$websiteDns = $websiteDnsRepository->findOneBy(['dns' => $dns]);
|
||||
if(!$websiteDns instanceof WebsiteDns) {
|
||||
return $this->json([
|
||||
'status' => 'unkown'
|
||||
],Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
$website = $websiteDns->getWebsite();
|
||||
return $this->json([
|
||||
'status' => $website->getState(),
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Controller\Artemis\EsyWeb;
|
||||
|
||||
use App\Entity\EsyWeb\Website;
|
||||
use App\Entity\EsyWeb\WebsiteDns;
|
||||
use App\Entity\EsyWeb\WebsiteKey;
|
||||
use App\Form\Artemis\EsyWeb\WebsiteType;
|
||||
use App\Repository\EsyWeb\WebsiteRepository;
|
||||
use App\Repository\EsyWebTutoRepository;
|
||||
@@ -50,7 +52,7 @@ class EsyWebController extends AbstractController
|
||||
'website' => $website
|
||||
]);
|
||||
}
|
||||
#[Route(path: '/artemis/esyweb/website/add', name: 'artemis_esyweb_add', methods: ['GET', 'POST'])]
|
||||
#[Route(path: '/artemis/esyweb/website/add', name: 'artemis_esyweb_add', methods: ['GET', 'POST'],priority: 5)]
|
||||
public function websiteAdd(LoggerService $loggerService,Request $request,EntityManagerInterface $entityManager,EventDispatcherInterface $eventDispatcher)
|
||||
{
|
||||
$loggerService->log("VIEW","Affiche la page de création de site internet",$this->getUser());
|
||||
@@ -65,9 +67,23 @@ class EsyWebController extends AbstractController
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$slug = new Slugify();
|
||||
$website->setMainDns($slug->slugify($website->getTitle()).".esy-web.dev");
|
||||
$loggerService->log("CREATED","Création d'un site internet");
|
||||
|
||||
$websiteKey = new WebsiteKey();
|
||||
$websiteKey->setType("api_key");
|
||||
$websiteKey->setApiKey(Uuid::v4());
|
||||
$websiteKey->setWebsitre($website);
|
||||
$entityManager->persist($websiteKey);
|
||||
|
||||
$websiteDns = new WebsiteDns();
|
||||
$websiteDns->setWebsite($website);
|
||||
$websiteDns->setIsMain(true);
|
||||
$websiteDns->setDns($slug->slugify($website->getTitle()).".esy-web.dev");
|
||||
$entityManager->persist($websiteDns);
|
||||
|
||||
|
||||
$entityManager->persist($website);
|
||||
$entityManager->flush();
|
||||
$loggerService->log("CREATED","Création d'un site internet");
|
||||
$eventDispatcher->dispatch(new EventCreatedWebsite($website));
|
||||
return $this->redirectToRoute('artemis_esyweb');
|
||||
}
|
||||
|
||||
@@ -670,7 +670,7 @@ class CustomerController extends AbstractController
|
||||
$event = new EventSpaceCustomerCreated($account,$password);
|
||||
$eventDispatcher->dispatch($event);
|
||||
$entityManager->flush();
|
||||
$this->addFlash("danger","Création de l'espace client effectuée ! ");
|
||||
$this->addFlash("danger","Création de l'espagce client effectuée ! ");
|
||||
return $this->redirectToRoute('artemis_intranet_customer_view', ['id' => $customer->getId()]);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Entity\EsyWeb\Website;
|
||||
use App\Entity\EsyWeb\WebsiteDns;
|
||||
use App\Repository\CustomerDnsRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
@@ -43,8 +44,8 @@ class CustomerDns
|
||||
#[ORM\OneToMany(targetEntity: CustomerDnsEmail::class, mappedBy: 'dns')]
|
||||
private Collection $customerDnsEmails;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'ndd')]
|
||||
private ?Website $website = null;
|
||||
#[ORM\OneToOne(mappedBy: 'customerDns', cascade: ['persist', 'remove'])]
|
||||
private ?WebsiteDns $websiteDns = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -170,14 +171,24 @@ class CustomerDns
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWebsite(): ?Website
|
||||
public function getWebsiteDns(): ?WebsiteDns
|
||||
{
|
||||
return $this->website;
|
||||
return $this->websiteDns;
|
||||
}
|
||||
|
||||
public function setWebsite(?Website $website): static
|
||||
public function setWebsiteDns(?WebsiteDns $websiteDns): static
|
||||
{
|
||||
$this->website = $website;
|
||||
// unset the owning side of the relation if necessary
|
||||
if ($websiteDns === null && $this->websiteDns !== null) {
|
||||
$this->websiteDns->setCustomerDns(null);
|
||||
}
|
||||
|
||||
// set the owning side of the relation if necessary
|
||||
if ($websiteDns !== null && $websiteDns->getCustomerDns() !== $this) {
|
||||
$websiteDns->setCustomerDns($this);
|
||||
}
|
||||
|
||||
$this->websiteDns = $websiteDns;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -25,12 +25,6 @@ class Website
|
||||
#[ORM\Column(type: 'uuid')]
|
||||
private ?Uuid $uuid = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, CustomerDns>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: CustomerDns::class, mappedBy: 'website')]
|
||||
private Collection $ndd;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $mainDns = null;
|
||||
|
||||
@@ -46,9 +40,22 @@ class Website
|
||||
#[ORM\ManyToOne(inversedBy: 'websites')]
|
||||
private ?Revendeur $revendeur = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, WebsiteDns>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: WebsiteDns::class, mappedBy: 'website', cascade: ['persist'])]
|
||||
private Collection $websiteDns;
|
||||
|
||||
/**
|
||||
* @var Collection<int, WebsiteKey>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: WebsiteKey::class, mappedBy: 'websitre')]
|
||||
private Collection $websiteKeys;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ndd = new ArrayCollection();
|
||||
$this->websiteDns = new ArrayCollection();
|
||||
$this->websiteKeys = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -80,36 +87,6 @@ class Website
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, CustomerDns>
|
||||
*/
|
||||
public function getNdd(): Collection
|
||||
{
|
||||
return $this->ndd;
|
||||
}
|
||||
|
||||
public function addNdd(CustomerDns $ndd): static
|
||||
{
|
||||
if (!$this->ndd->contains($ndd)) {
|
||||
$this->ndd->add($ndd);
|
||||
$ndd->setWebsite($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeNdd(CustomerDns $ndd): static
|
||||
{
|
||||
if ($this->ndd->removeElement($ndd)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($ndd->getWebsite() === $this) {
|
||||
$ndd->setWebsite(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMainDns(): ?string
|
||||
{
|
||||
return $this->mainDns;
|
||||
@@ -169,4 +146,70 @@ class Website
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, WebsiteDns>
|
||||
*/
|
||||
public function getWebsiteDns(): Collection
|
||||
{
|
||||
return $this->websiteDns;
|
||||
}
|
||||
|
||||
public function addWebsiteDn(WebsiteDns $websiteDn): static
|
||||
{
|
||||
if (!$this->websiteDns->contains($websiteDn)) {
|
||||
$this->websiteDns->add($websiteDn);
|
||||
$websiteDn->setWebsite($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeWebsiteDn(WebsiteDns $websiteDn): static
|
||||
{
|
||||
if ($this->websiteDns->removeElement($websiteDn)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($websiteDn->getWebsite() === $this) {
|
||||
$websiteDn->setWebsite(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
// Return a meaningful property that identifies the entity
|
||||
return (string) $this->getTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, WebsiteKey>
|
||||
*/
|
||||
public function getWebsiteKeys(): Collection
|
||||
{
|
||||
return $this->websiteKeys;
|
||||
}
|
||||
|
||||
public function addWebsiteKey(WebsiteKey $websiteKey): static
|
||||
{
|
||||
if (!$this->websiteKeys->contains($websiteKey)) {
|
||||
$this->websiteKeys->add($websiteKey);
|
||||
$websiteKey->setWebsitre($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeWebsiteKey(WebsiteKey $websiteKey): static
|
||||
{
|
||||
if ($this->websiteKeys->removeElement($websiteKey)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($websiteKey->getWebsitre() === $this) {
|
||||
$websiteKey->setWebsitre(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
81
src/Entity/EsyWeb/WebsiteDns.php
Normal file
81
src/Entity/EsyWeb/WebsiteDns.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\EsyWeb;
|
||||
|
||||
use App\Entity\CustomerDns;
|
||||
use App\Repository\EsyWeb\WebsiteDnsRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: WebsiteDnsRepository::class)]
|
||||
class WebsiteDns
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $isMain = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $dns = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'websiteDns')]
|
||||
private ?Website $website = null;
|
||||
|
||||
#[ORM\OneToOne(inversedBy: 'websiteDns', cascade: ['persist', 'remove'])]
|
||||
private ?CustomerDns $customerDns = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function isMain(): ?bool
|
||||
{
|
||||
return $this->isMain;
|
||||
}
|
||||
|
||||
public function setIsMain(bool $isMain): static
|
||||
{
|
||||
$this->isMain = $isMain;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDns(): ?string
|
||||
{
|
||||
return $this->dns;
|
||||
}
|
||||
|
||||
public function setDns(string $dns): static
|
||||
{
|
||||
$this->dns = $dns;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWebsite(): ?Website
|
||||
{
|
||||
return $this->website;
|
||||
}
|
||||
|
||||
public function setWebsite(?Website $website): static
|
||||
{
|
||||
$this->website = $website;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustomerDns(): ?CustomerDns
|
||||
{
|
||||
return $this->customerDns;
|
||||
}
|
||||
|
||||
public function setCustomerDns(?CustomerDns $customerDns): static
|
||||
{
|
||||
$this->customerDns = $customerDns;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
65
src/Entity/EsyWeb/WebsiteKey.php
Normal file
65
src/Entity/EsyWeb/WebsiteKey.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\EsyWeb;
|
||||
|
||||
use App\Repository\EsyWeb\WebsiteKeyRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: WebsiteKeyRepository::class)]
|
||||
class WebsiteKey
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $type = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $apiKey = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'websiteKeys')]
|
||||
private ?Website $websitre = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getType(): ?string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setType(string $type): static
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getApiKey(): ?string
|
||||
{
|
||||
return $this->apiKey;
|
||||
}
|
||||
|
||||
public function setApiKey(string $apiKey): static
|
||||
{
|
||||
$this->apiKey = $apiKey;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWebsitre(): ?Website
|
||||
{
|
||||
return $this->websitre;
|
||||
}
|
||||
|
||||
public function setWebsitre(?Website $websitre): static
|
||||
{
|
||||
$this->websitre = $websitre;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -42,14 +42,23 @@ class ApiSubscriber
|
||||
$event->stopPropagation();
|
||||
return;
|
||||
} else {
|
||||
if($request->headers->get('EsyWebKey') != $_ENV['APP_SECRET']) {
|
||||
$event->setResponse(new JsonResponse([
|
||||
'state' => 'error',
|
||||
'message' => 'Header `EsyWebKey` Is Invalid'
|
||||
]));
|
||||
$event->stopPropagation();
|
||||
return;
|
||||
}
|
||||
if($request->headers->get('EsyWebKey') != $_ENV['APP_SECRET']) {
|
||||
$event->setResponse(new JsonResponse([
|
||||
'state' => 'error',
|
||||
'message' => 'Header `EsyWebKey` Is Invalid'
|
||||
]));
|
||||
$event->stopPropagation();
|
||||
return;
|
||||
} else {
|
||||
if(!$request->headers->has('EsyWebDns')) {
|
||||
$event->setResponse(new JsonResponse([
|
||||
'state' => 'error',
|
||||
'message' => 'Missing Header `EsyWebDns`'
|
||||
]));
|
||||
$event->stopPropagation();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
43
src/Repository/EsyWeb/WebsiteDnsRepository.php
Normal file
43
src/Repository/EsyWeb/WebsiteDnsRepository.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository\EsyWeb;
|
||||
|
||||
use App\Entity\EsyWeb\WebsiteDns;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<WebsiteDns>
|
||||
*/
|
||||
class WebsiteDnsRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, WebsiteDns::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return WebsiteDns[] Returns an array of WebsiteDns objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('w')
|
||||
// ->andWhere('w.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('w.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?WebsiteDns
|
||||
// {
|
||||
// return $this->createQueryBuilder('w')
|
||||
// ->andWhere('w.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
43
src/Repository/EsyWeb/WebsiteKeyRepository.php
Normal file
43
src/Repository/EsyWeb/WebsiteKeyRepository.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository\EsyWeb;
|
||||
|
||||
use App\Entity\EsyWeb\WebsiteKey;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<WebsiteKey>
|
||||
*/
|
||||
class WebsiteKeyRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, WebsiteKey::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return WebsiteKey[] Returns an array of WebsiteKey objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('w')
|
||||
// ->andWhere('w.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('w.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?WebsiteKey
|
||||
// {
|
||||
// return $this->createQueryBuilder('w')
|
||||
// ->andWhere('w.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user