Compare commits
19 commits
Author | SHA1 | Date | |
---|---|---|---|
Simon Vieille | 63bc4cde1c | ||
Simon Vieille | 2b43f97315 | ||
Simon Vieille | 10564e6d37 | ||
Simon Vieille | ebbb4c01e0 | ||
Simon Vieille | 43fb25d122 | ||
Simon Vieille | 4253985bc3 | ||
Simon Vieille | 79d549254f | ||
Simon Vieille | c79e96e291 | ||
Simon Vieille | 092b490ae2 | ||
Simon Vieille | fcecf74f90 | ||
c00723a246 | |||
e81b11c5ec | |||
af2212ac8c | |||
b57b0e3770 | |||
ba76a83163 | |||
2874f579dc | |||
287e1d66cb | |||
b23a4fe9c5 | |||
59bbd24b76 |
|
@ -9,7 +9,7 @@ services:
|
|||
environment:
|
||||
- MARIADB_ROOT_PASSWORD=root
|
||||
|
||||
pipeline:
|
||||
steps:
|
||||
db_wait:
|
||||
image: gitnet.fr/deblan/timeout:latest
|
||||
commands:
|
||||
|
@ -21,7 +21,7 @@ pipeline:
|
|||
- mysql -hdb -uroot -proot -e "CREATE DATABASE app"
|
||||
|
||||
config:
|
||||
image: deblan/php:8.1
|
||||
image: deblan/php:${PHP_VERSION}
|
||||
commands:
|
||||
- echo APP_ENV=prod >> .env.local
|
||||
- echo APP_SECRET=$(openssl rand -hex 32) >> .env.local
|
||||
|
|
30
CHANGELOG.md
30
CHANGELOG.md
|
@ -1,10 +1,30 @@
|
|||
## [Unreleased]
|
||||
|
||||
## [1.21.0] 2023-08-11
|
||||
## [v1.25.1] - 2024-05-13
|
||||
### Fixed
|
||||
* fix murph-npm version
|
||||
|
||||
## [v1.25.0] - 2024-05-12
|
||||
### Changed
|
||||
* upgrade murph/murph-core
|
||||
|
||||
## [1.20.0] 2023-07-27
|
||||
## [v1.23.0] - 2023-09-28
|
||||
### Changed
|
||||
* upgrade murph/murph-core
|
||||
|
||||
## [v1.22.0] - 2023-09-28
|
||||
### Added
|
||||
* update woodpecker ci base file
|
||||
### Fixed
|
||||
* fix #1: add UniqueEntity constraint in the User entity
|
||||
### Changed
|
||||
* upgrade murph/murph-core
|
||||
|
||||
## [1.21.0] - 2023-08-11
|
||||
### Changed
|
||||
* upgrade murph/murph-core
|
||||
|
||||
## [1.20.0] - 2023-07-27
|
||||
### Fixed
|
||||
* fix collection widget: allow_add/allow_delete and prototype
|
||||
### Added
|
||||
|
@ -13,11 +33,11 @@
|
|||
### Changed
|
||||
* upgrade murph/murph-core
|
||||
|
||||
## [1.19.0] 2023-04-15
|
||||
## [1.19.0] - 2023-04-15
|
||||
### Changed
|
||||
* upgrade murph/murph-core
|
||||
|
||||
## [1.18.0] 2023-01-13
|
||||
## [1.18.0] - 2023-01-13
|
||||
### Added
|
||||
* feat(dep): update dependencies
|
||||
* feat(update): apply new recipe for phpunit
|
||||
|
@ -45,7 +65,7 @@
|
|||
* fix(config): fix firewall config
|
||||
|
||||
|
||||
## [1.17.0] 2022-11-19
|
||||
## [1.17.0] - 2022-11-19
|
||||
### Changed
|
||||
* upgrade murph/murph-core
|
||||
* replace annotation with attributes
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.0.0",
|
||||
"murph/murph-core": "^1.20"
|
||||
"murph/murph-core": "^1.25"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/browser-kit": "^5.4",
|
||||
|
|
|
@ -3,6 +3,10 @@ security:
|
|||
App\Entity\User:
|
||||
algorithm: auto
|
||||
|
||||
access_decision_manager:
|
||||
strategy: consensus
|
||||
allow_if_all_abstain: false
|
||||
|
||||
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
|
||||
enable_authenticator_manager: true
|
||||
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
|
||||
|
|
11023
package-lock.json
generated
11023
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -9,9 +9,11 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
||||
#[ORM\HasLifecycleCallbacks]
|
||||
#[UniqueEntity('email')]
|
||||
class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFactorInterface, EntityInterface
|
||||
{
|
||||
use Timestampable;
|
||||
|
|
|
@ -2,10 +2,17 @@
|
|||
|
||||
namespace App;
|
||||
|
||||
use App\Core\DependencyInjection\Compiler\BuilderBlockPass;
|
||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
class Kernel extends BaseKernel
|
||||
{
|
||||
use MicroKernelTrait;
|
||||
|
||||
protected function build(ContainerBuilder $container): void
|
||||
{
|
||||
$container->addCompilerPass(new BuilderBlockPass());
|
||||
}
|
||||
}
|
||||
|
|
51
src/Security/Voter/EntityVoter.php
Normal file
51
src/Security/Voter/EntityVoter.php
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace App\Security\Voter;
|
||||
|
||||
use App\Core\Entity\EntityInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
class EntityVoter extends Voter
|
||||
{
|
||||
public const EDIT = 'edit';
|
||||
public const VIEW = 'show';
|
||||
public const DELETE = 'delete';
|
||||
|
||||
protected function supports(string $attribute, mixed $subject): bool
|
||||
{
|
||||
// replace with your own logic
|
||||
// https://symfony.com/doc/current/security/voters.html
|
||||
return in_array($attribute, [self::EDIT, self::VIEW, self::DELETE])
|
||||
&& $subject instanceof EntityInterface;
|
||||
}
|
||||
|
||||
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
|
||||
{
|
||||
$user = $token->getUser();
|
||||
|
||||
if (!$user instanceof UserInterface) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ($attribute) {
|
||||
case self::EDIT:
|
||||
return true;
|
||||
|
||||
break;
|
||||
|
||||
case self::VIEW:
|
||||
return true;
|
||||
|
||||
break;
|
||||
|
||||
case self::DELETE:
|
||||
return true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue