Compare commits
10 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 |
|
@ -1,5 +1,13 @@
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [v1.25.1] - 2024-05-13
|
||||||
|
### Fixed
|
||||||
|
* fix murph-npm version
|
||||||
|
|
||||||
|
## [v1.25.0] - 2024-05-12
|
||||||
|
### Changed
|
||||||
|
* upgrade murph/murph-core
|
||||||
|
|
||||||
## [v1.23.0] - 2023-09-28
|
## [v1.23.0] - 2023-09-28
|
||||||
### Changed
|
### Changed
|
||||||
* upgrade murph/murph-core
|
* upgrade murph/murph-core
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.0.0",
|
"php": ">=8.0.0",
|
||||||
"murph/murph-core": "^1.23"
|
"murph/murph-core": "^1.25"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/browser-kit": "^5.4",
|
"symfony/browser-kit": "^5.4",
|
||||||
|
|
|
@ -3,6 +3,10 @@ security:
|
||||||
App\Entity\User:
|
App\Entity\User:
|
||||||
algorithm: auto
|
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
|
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
|
||||||
enable_authenticator_manager: true
|
enable_authenticator_manager: true
|
||||||
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
|
# 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
|
@ -2,10 +2,17 @@
|
||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
|
use App\Core\DependencyInjection\Compiler\BuilderBlockPass;
|
||||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
|
||||||
class Kernel extends BaseKernel
|
class Kernel extends BaseKernel
|
||||||
{
|
{
|
||||||
use MicroKernelTrait;
|
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