diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
new file mode 100644
index 0000000..f782d7a
--- /dev/null
+++ b/.idea/dataSources.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ postgresql
+ true
+ org.postgresql.Driver
+ jdbc:postgresql://localhost:5433/HegreEtConfort
+ $ProjectFileDir$
+
+
+
\ No newline at end of file
diff --git a/config/packages/security.yaml b/config/packages/security.yaml
index fbfb8ed..415ad31 100644
--- a/config/packages/security.yaml
+++ b/config/packages/security.yaml
@@ -7,7 +7,7 @@ security:
# used to reload user from session & other features (e.g. switch_user)
app_user_provider:
entity:
- class: App\Entity\User
+ class: App\Entity\Utilisateur
property: email
firewalls:
dev:
@@ -17,6 +17,7 @@ security:
lazy: true
provider: app_user_provider
+
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#the-firewall
@@ -26,8 +27,8 @@ security:
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
- # - { path: ^/admin, roles: ROLE_ADMIN }
- # - { path: ^/profile, roles: ROLE_USER }
+ - { path: ^/admin, roles: ROLE_ADMIN }
+ - { path: ^/profile, roles: ROLE_USER }
when@test:
security:
diff --git a/migrations/Version20241205162005.php b/migrations/Version20241205162005.php
deleted file mode 100644
index 9f8bff3..0000000
--- a/migrations/Version20241205162005.php
+++ /dev/null
@@ -1,50 +0,0 @@
-addSql('CREATE SEQUENCE fault_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
- $this->addSql('CREATE SEQUENCE intervention_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
- $this->addSql('CREATE SEQUENCE skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
- $this->addSql('CREATE SEQUENCE stock_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
- $this->addSql('CREATE SEQUENCE user_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
- $this->addSql('CREATE SEQUENCE vehicle_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
- $this->addSql('ALTER TABLE "user" ADD roles JSON NOT NULL');
- $this->addSql('ALTER TABLE "user" ALTER email TYPE VARCHAR(180)');
- $this->addSql('ALTER TABLE "user" RENAME COLUMN type TO password');
- $this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON "user" (email)');
- }
-
- 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('DROP SEQUENCE fault_id_seq CASCADE');
- $this->addSql('DROP SEQUENCE intervention_id_seq CASCADE');
- $this->addSql('DROP SEQUENCE skill_id_seq CASCADE');
- $this->addSql('DROP SEQUENCE stock_id_seq CASCADE');
- $this->addSql('DROP SEQUENCE user_id_seq CASCADE');
- $this->addSql('DROP SEQUENCE vehicle_id_seq CASCADE');
- $this->addSql('DROP INDEX UNIQ_IDENTIFIER_EMAIL');
- $this->addSql('ALTER TABLE "user" DROP roles');
- $this->addSql('ALTER TABLE "user" ALTER email TYPE VARCHAR(255)');
- $this->addSql('ALTER TABLE "user" RENAME COLUMN password TO type');
- }
-}
diff --git a/migrations/Version20241212153452.php b/migrations/Version20241212153452.php
deleted file mode 100644
index 13cf6d3..0000000
--- a/migrations/Version20241212153452.php
+++ /dev/null
@@ -1,31 +0,0 @@
-addSql('CREATE SCHEMA public');
- }
-}
diff --git a/migrations/Version20250410124208.php b/migrations/Version20250410124208.php
new file mode 100644
index 0000000..d1fe4fb
--- /dev/null
+++ b/migrations/Version20250410124208.php
@@ -0,0 +1,71 @@
+addSql('CREATE SEQUENCE fault_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
+ $this->addSql('CREATE SEQUENCE intervention_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
+ $this->addSql('CREATE SEQUENCE skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
+ $this->addSql('CREATE SEQUENCE stock_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
+ $this->addSql('CREATE SEQUENCE utilisateur_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
+ $this->addSql('CREATE SEQUENCE vehicle_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
+ $this->addSql('CREATE TABLE fault (id INT NOT NULL, wording VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
+ $this->addSql('CREATE TABLE intervention (id INT NOT NULL, wording VARCHAR(255) NOT NULL, timestamp TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, description VARCHAR(255) NOT NULL, address VARCHAR(255) NOT NULL, status VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
+ $this->addSql('CREATE TABLE skill (id INT NOT NULL, wording VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
+ $this->addSql('CREATE TABLE stock (id INT NOT NULL, wording VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, quantity VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
+ $this->addSql('CREATE TABLE utilisateur (id INT NOT NULL, email VARCHAR(180) NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, birth_date DATE NOT NULL, phone VARCHAR(255) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
+ $this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON utilisateur (email)');
+ $this->addSql('CREATE TABLE vehicle (id INT NOT NULL, license_plate VARCHAR(255) NOT NULL, brand VARCHAR(255) NOT NULL, model VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
+ $this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
+ $this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
+ $this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
+ $this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
+ $this->addSql('COMMENT ON COLUMN messenger_messages.created_at IS \'(DC2Type:datetime_immutable)\'');
+ $this->addSql('COMMENT ON COLUMN messenger_messages.available_at IS \'(DC2Type:datetime_immutable)\'');
+ $this->addSql('COMMENT ON COLUMN messenger_messages.delivered_at IS \'(DC2Type:datetime_immutable)\'');
+ $this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$
+ BEGIN
+ PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text);
+ RETURN NEW;
+ END;
+ $$ LANGUAGE plpgsql;');
+ $this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;');
+ $this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();');
+ }
+
+ 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('DROP SEQUENCE fault_id_seq CASCADE');
+ $this->addSql('DROP SEQUENCE intervention_id_seq CASCADE');
+ $this->addSql('DROP SEQUENCE skill_id_seq CASCADE');
+ $this->addSql('DROP SEQUENCE stock_id_seq CASCADE');
+ $this->addSql('DROP SEQUENCE utilisateur_id_seq CASCADE');
+ $this->addSql('DROP SEQUENCE vehicle_id_seq CASCADE');
+ $this->addSql('DROP TABLE fault');
+ $this->addSql('DROP TABLE intervention');
+ $this->addSql('DROP TABLE skill');
+ $this->addSql('DROP TABLE stock');
+ $this->addSql('DROP TABLE utilisateur');
+ $this->addSql('DROP TABLE vehicle');
+ $this->addSql('DROP TABLE messenger_messages');
+ }
+}
diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php
index 6a5e8a0..516ff1f 100644
--- a/src/Controller/UserController.php
+++ b/src/Controller/UserController.php
@@ -2,7 +2,7 @@
namespace App\Controller;
-use App\Entity\User;
+use App\Entity\Utilisateur;
use App\Form\UserType;
use App\Repository\UserRepository;
use Doctrine\ORM\EntityManagerInterface;
@@ -25,7 +25,7 @@ final class UserController extends AbstractController
#[Route('/new', name: 'app_user_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
- $user = new User();
+ $user = new Utilisateur();
$form = $this->createForm(UserType::class, $user);
$form->handleRequest($request);
@@ -43,7 +43,7 @@ final class UserController extends AbstractController
}
#[Route('/{id}', name: 'app_user_show', methods: ['GET'])]
- public function show(User $user): Response
+ public function show(Utilisateur $user): Response
{
return $this->render('user/show.html.twig', [
'user' => $user,
@@ -51,7 +51,7 @@ final class UserController extends AbstractController
}
#[Route('/{id}/edit', name: 'app_user_edit', methods: ['GET', 'POST'])]
- public function edit(Request $request, User $user, EntityManagerInterface $entityManager): Response
+ public function edit(Request $request, Utilisateur $user, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(UserType::class, $user);
$form->handleRequest($request);
@@ -69,7 +69,7 @@ final class UserController extends AbstractController
}
#[Route('/{id}', name: 'app_user_delete', methods: ['POST'])]
- public function delete(Request $request, User $user, EntityManagerInterface $entityManager): Response
+ public function delete(Request $request, Utilisateur $user, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$user->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($user);
diff --git a/src/Entity/User.php b/src/Entity/Utilisateur.php
similarity index 97%
rename from src/Entity/User.php
rename to src/Entity/Utilisateur.php
index 3ebcbae..2b70023 100644
--- a/src/Entity/User.php
+++ b/src/Entity/Utilisateur.php
@@ -10,7 +10,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_EMAIL', fields: ['email'])]
-class User implements UserInterface, PasswordAuthenticatedUserInterface
+class Utilisateur implements UserInterface, PasswordAuthenticatedUserInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
diff --git a/src/Form/UserType.php b/src/Form/UserType.php
index a3278f1..6059187 100644
--- a/src/Form/UserType.php
+++ b/src/Form/UserType.php
@@ -2,7 +2,7 @@
namespace App\Form;
-use App\Entity\User;
+use App\Entity\Utilisateur;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
@@ -32,7 +32,7 @@ class UserType extends AbstractType
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
- 'data_class' => User::class,
+ 'data_class' => Utilisateur::class,
]);
}
}
diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php
index 4f2804e..b3a23e8 100644
--- a/src/Repository/UserRepository.php
+++ b/src/Repository/UserRepository.php
@@ -2,7 +2,7 @@
namespace App\Repository;
-use App\Entity\User;
+use App\Entity\Utilisateur;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
@@ -10,13 +10,13 @@ use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
/**
- * @extends ServiceEntityRepository
+ * @extends ServiceEntityRepository
*/
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
{
public function __construct(ManagerRegistry $registry)
{
- parent::__construct($registry, User::class);
+ parent::__construct($registry, Utilisateur::class);
}
/**
@@ -24,7 +24,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
*/
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
{
- if (!$user instanceof User) {
+ if (!$user instanceof Utilisateur) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class));
}
@@ -34,7 +34,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
}
// /**
- // * @return User[] Returns an array of User objects
+ // * @return Utilisateur[] Returns an array of Utilisateur objects
// */
// public function findByExampleField($value): array
// {
@@ -48,7 +48,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
// ;
// }
- // public function findOneBySomeField($value): ?User
+ // public function findOneBySomeField($value): ?Utilisateur
// {
// return $this->createQueryBuilder('u')
// ->andWhere('u.exampleField = :val')
diff --git a/templates/login/index.html.twig b/templates/login/index.html.twig
index 46d3c81..ba47c25 100644
--- a/templates/login/index.html.twig
+++ b/templates/login/index.html.twig
@@ -40,14 +40,11 @@
-
-
+
+
+
-
-
-
- Mot de passe oubliƩ ?