mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
AccompanyingPeriodResource: add ACL
This commit is contained in:
parent
2c4d06371c
commit
7564c2fde1
@ -14,6 +14,7 @@ namespace Chill\PersonBundle\DependencyInjection;
|
|||||||
use Chill\MainBundle\DependencyInjection\MissingBundleException;
|
use Chill\MainBundle\DependencyInjection\MissingBundleException;
|
||||||
use Chill\MainBundle\Security\Authorization\ChillExportVoter;
|
use Chill\MainBundle\Security\Authorization\ChillExportVoter;
|
||||||
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
|
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodResourceVoter;
|
||||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
use Exception;
|
use Exception;
|
||||||
@ -425,11 +426,10 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
Request::METHOD_PATCH => true,
|
Request::METHOD_PATCH => true,
|
||||||
Request::METHOD_HEAD => false,
|
Request::METHOD_HEAD => false,
|
||||||
Request::METHOD_DELETE => false,
|
Request::METHOD_DELETE => false,
|
||||||
], /*
|
|
||||||
'roles' => [
|
|
||||||
//Request::METHOD_PATCH => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE
|
|
||||||
],
|
],
|
||||||
*/
|
'roles' => [
|
||||||
|
Request::METHOD_PATCH => AccompanyingPeriodResourceVoter::EDIT,
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -23,6 +23,11 @@ class AccompanyingPeriodResourceVoter extends Voter
|
|||||||
|
|
||||||
private AccessDecisionManagerInterface $accessDecisionManager;
|
private AccessDecisionManagerInterface $accessDecisionManager;
|
||||||
|
|
||||||
|
public function __construct(AccessDecisionManagerInterface $accessDecisionManager)
|
||||||
|
{
|
||||||
|
$this->accessDecisionManager = $accessDecisionManager;
|
||||||
|
}
|
||||||
|
|
||||||
protected function supports($attribute, $subject)
|
protected function supports($attribute, $subject)
|
||||||
{
|
{
|
||||||
return $subject instanceof Resource && self::EDIT === $attribute;
|
return $subject instanceof Resource && self::EDIT === $attribute;
|
||||||
@ -35,7 +40,7 @@ class AccompanyingPeriodResourceVoter extends Voter
|
|||||||
case self::EDIT:
|
case self::EDIT:
|
||||||
return $this->accessDecisionManager->decide(
|
return $this->accessDecisionManager->decide(
|
||||||
$token,
|
$token,
|
||||||
AccompanyingPeriodVoter::EDIT,
|
[AccompanyingPeriodVoter::EDIT],
|
||||||
$subject->getAccompanyingPeriod()
|
$subject->getAccompanyingPeriod()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user