From 130cc96eb255dab8a2a0f24c71b0e6b49f3aa574 Mon Sep 17 00:00:00 2001 From: barillote Date: Thu, 3 Oct 2024 15:50:42 +0200 Subject: [PATCH 1/9] Supprimer .idea/HegreSphere.iml --- .idea/HegreSphere.iml | 141 ------------------------------------------ 1 file changed, 141 deletions(-) delete mode 100644 .idea/HegreSphere.iml diff --git a/.idea/HegreSphere.iml b/.idea/HegreSphere.iml deleted file mode 100644 index f4221e4..0000000 --- a/.idea/HegreSphere.iml +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 753269cae853f3a15be8ba7306b96cf104ed814f Mon Sep 17 00:00:00 2001 From: barillote Date: Thu, 3 Oct 2024 15:50:51 +0200 Subject: [PATCH 2/9] Supprimer .idea/.gitignore --- .idea/.gitignore | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml From 61b421b9f2ca4f4a7ff20cefc3ebf4ae7ae7aef8 Mon Sep 17 00:00:00 2001 From: barillote Date: Thu, 3 Oct 2024 15:50:56 +0200 Subject: [PATCH 3/9] Supprimer .idea/modules.xml --- .idea/modules.xml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/modules.xml diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 76fffc5..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file From 92bf7c19994912e5794697f3ef2416a21fd7e4d3 Mon Sep 17 00:00:00 2001 From: barillote Date: Thu, 3 Oct 2024 15:51:00 +0200 Subject: [PATCH 4/9] Supprimer .idea/php.xml --- .idea/php.xml | 159 -------------------------------------------------- 1 file changed, 159 deletions(-) delete mode 100644 .idea/php.xml diff --git a/.idea/php.xml b/.idea/php.xml deleted file mode 100644 index e89704b..0000000 --- a/.idea/php.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From bf64d88eb4b66b8f7d0d960b2c887e2e437a17c2 Mon Sep 17 00:00:00 2001 From: barillote Date: Thu, 3 Oct 2024 15:51:04 +0200 Subject: [PATCH 5/9] Supprimer .idea/phpunit.xml --- .idea/phpunit.xml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .idea/phpunit.xml diff --git a/.idea/phpunit.xml b/.idea/phpunit.xml deleted file mode 100644 index 4f8104c..0000000 --- a/.idea/phpunit.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file From 0058989ca9fc87967326f0e66463e85255d1cf00 Mon Sep 17 00:00:00 2001 From: barillote Date: Thu, 3 Oct 2024 15:51:08 +0200 Subject: [PATCH 6/9] Supprimer .idea/vcs.xml --- .idea/vcs.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 3df2feb33c60341b603e991f53215d6550fdf147 Mon Sep 17 00:00:00 2001 From: ALLAVENA--VALETTE Romain Date: Thu, 3 Oct 2024 17:23:33 +0200 Subject: [PATCH 7/9] reset et creation User --- .idea/.gitignore | 8 ++ .idea/hegresphere.iml | 141 ++++++++++++++++++++++++++ .idea/modules.xml | 8 ++ .idea/php.xml | 159 ++++++++++++++++++++++++++++++ .idea/phpunit.xml | 10 ++ .idea/vcs.xml | 6 ++ config/packages/security.yaml | 8 +- src/Entity/User.php | 109 ++++++++++++++++++++ src/Repository/UserRepository.php | 60 +++++++++++ 9 files changed, 507 insertions(+), 2 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/hegresphere.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/php.xml create mode 100644 .idea/phpunit.xml create mode 100644 .idea/vcs.xml create mode 100644 src/Entity/User.php create mode 100644 src/Repository/UserRepository.php diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/hegresphere.iml b/.idea/hegresphere.iml new file mode 100644 index 0000000..f4221e4 --- /dev/null +++ b/.idea/hegresphere.iml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..8987bd1 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..e5c6300 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/phpunit.xml b/.idea/phpunit.xml new file mode 100644 index 0000000..4f8104c --- /dev/null +++ b/.idea/phpunit.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 367af25..6b3167f 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -4,14 +4,18 @@ security: Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider providers: - users_in_memory: { memory: null } + # used to reload user from session & other features (e.g. switch_user) + app_user_provider: + entity: + class: App\Entity\User + property: nickname firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false main: lazy: true - provider: users_in_memory + provider: app_user_provider # activate different ways to authenticate # https://symfony.com/doc/current/security.html#the-firewall diff --git a/src/Entity/User.php b/src/Entity/User.php new file mode 100644 index 0000000..34c4b48 --- /dev/null +++ b/src/Entity/User.php @@ -0,0 +1,109 @@ + The user roles + */ + #[ORM\Column] + private array $roles = []; + + /** + * @var string The hashed password + */ + #[ORM\Column] + private ?string $password = null; + + public function getId(): ?int + { + return $this->id; + } + + public function getNickname(): ?string + { + return $this->nickname; + } + + public function setNickname(string $nickname): static + { + $this->nickname = $nickname; + + return $this; + } + + /** + * A visual identifier that represents this user. + * + * @see UserInterface + */ + public function getUserIdentifier(): string + { + return (string) $this->nickname; + } + + /** + * @see UserInterface + * + * @return list + */ + public function getRoles(): array + { + $roles = $this->roles; + // guarantee every user at least has ROLE_USER + $roles[] = 'ROLE_USER'; + + return array_unique($roles); + } + + /** + * @param list $roles + */ + public function setRoles(array $roles): static + { + $this->roles = $roles; + + return $this; + } + + /** + * @see PasswordAuthenticatedUserInterface + */ + public function getPassword(): ?string + { + return $this->password; + } + + public function setPassword(string $password): static + { + $this->password = $password; + + return $this; + } + + /** + * @see UserInterface + */ + public function eraseCredentials(): void + { + // If you store any temporary, sensitive data on the user, clear it here + // $this->plainPassword = null; + } +} diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php new file mode 100644 index 0000000..4f2804e --- /dev/null +++ b/src/Repository/UserRepository.php @@ -0,0 +1,60 @@ + + */ +class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, User::class); + } + + /** + * Used to upgrade (rehash) the user's password automatically over time. + */ + public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void + { + if (!$user instanceof User) { + throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class)); + } + + $user->setPassword($newHashedPassword); + $this->getEntityManager()->persist($user); + $this->getEntityManager()->flush(); + } + + // /** + // * @return User[] Returns an array of User objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('u') + // ->andWhere('u.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('u.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?User + // { + // return $this->createQueryBuilder('u') + // ->andWhere('u.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} From 8cb42922aa16c036e9c7733aef1fb99a96dedc7b Mon Sep 17 00:00:00 2001 From: ALLAVENA--VALETTE Romain Date: Thu, 3 Oct 2024 17:24:47 +0200 Subject: [PATCH 8/9] gitignore --- .gitignore | 1 + .idea/.gitignore | 8 --- .idea/hegresphere.iml | 141 ------------------------------------- .idea/modules.xml | 8 --- .idea/php.xml | 159 ------------------------------------------ .idea/phpunit.xml | 10 --- .idea/vcs.xml | 6 -- 7 files changed, 1 insertion(+), 332 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/hegresphere.iml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/php.xml delete mode 100644 .idea/phpunit.xml delete mode 100644 .idea/vcs.xml diff --git a/.gitignore b/.gitignore index 4daae38..2b08932 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ /public/assets/ /assets/vendor/ ###< symfony/asset-mapper ### +./idea \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/hegresphere.iml b/.idea/hegresphere.iml deleted file mode 100644 index f4221e4..0000000 --- a/.idea/hegresphere.iml +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 8987bd1..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml deleted file mode 100644 index e5c6300..0000000 --- a/.idea/php.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/phpunit.xml b/.idea/phpunit.xml deleted file mode 100644 index 4f8104c..0000000 --- a/.idea/phpunit.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From a83a627a56333be6ebb6421129bb195b9ce42551 Mon Sep 17 00:00:00 2001 From: ALLAVENA--VALETTE Romain Date: Thu, 10 Oct 2024 14:47:52 +0200 Subject: [PATCH 9/9] update user --- src/Entity/User.php | 77 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/src/Entity/User.php b/src/Entity/User.php index 34c4b48..4536d5c 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -32,6 +32,21 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface #[ORM\Column] private ?string $password = null; + #[ORM\Column(length: 255)] + private ?string $firstName = null; + + #[ORM\Column(length: 255)] + private ?string $lastName = null; + + #[ORM\Column(length: 255)] + private ?string $tel = null; + + #[ORM\Column(length: 255)] + private ?string $address = null; + + #[ORM\Column(length: 255)] + private ?string $mail = null; + public function getId(): ?int { return $this->id; @@ -106,4 +121,66 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface // If you store any temporary, sensitive data on the user, clear it here // $this->plainPassword = null; } + + public function getFirstName(): ?string + { + return $this->firstName; + } + + public function setFirstName(string $firstName): static + { + $this->firstName = $firstName; + + return $this; + } + + public function getLastName(): ?string + { + return $this->lastName; + } + + public function setLastName(string $lastName): static + { + $this->lastName = $lastName; + + return $this; + } + + public function getTel(): ?string + { + return $this->tel; + } + + public function setTel(string $tel): static + { + $this->tel = $tel; + + return $this; + } + + public function getAddress(): ?string + { + return $this->address; + } + + public function setAddress(string $address): static + { + $this->address = $address; + + return $this; + } + + public function getMail(): ?string + { + return $this->mail; + } + + public function setMail(string $mail): static + { + $this->mail = $mail; + + return $this; + } } + +