Commit 51ee1b4b authored by Stéphane Bouvry's avatar Stéphane Bouvry
Browse files

Fix : Ajout d'un check sur la suppression des organisations directement dans...

Fix : Ajout d'un check sur la suppression des organisations directement dans le controller pour le rendre plus facilement paramétrable dans de futurs usages
parent dd7d6828
Loading
Loading
Loading
Loading
+6 −4
Changes for module/Oscar/config/module.config.php: 6 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -264,18 +264,20 @@ return array(
                ////////////////////////////////////////////////////////////////
                // ORGANIZATION
                ////////////////////////////////////////////////////////////////
                [ 'controller' =>   'Organization',
                    'action' => ['delete'],
                    'roles' => ['user']

                ],
                [ 'controller' =>   'Organization',
                    'action' => ['index', 'search'],
                    'privileges' => \Oscar\Provider\Privileges::ORGANIZATION_INDEX
                ],

                [ 'controller' =>   'Organization',
                    'action' => ['show'],
                    'privileges' => \Oscar\Provider\Privileges::ORGANIZATION_SHOW
                ],
                [ 'controller' =>   'Organization',
                    'action' => ['delete'],
                    'privileges' => \Oscar\Provider\Privileges::ORGANIZATION_DELETE
                ],
                [ 'controller' =>   'Organization',
                    'action' => ['edit', 'new', 'syncLdap', 'merge', 'close'],
                    'privileges' => \Oscar\Provider\Privileges::ORGANIZATION_EDIT
+3 −0
Changes for module/Oscar/src/Oscar/Controller/OrganizationController.php: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ use Oscar\Entity\Role;
use Oscar\Entity\RoleRepository;
use Oscar\Exception\OscarException;
use Oscar\Form\OrganizationIdentificationForm;
use Oscar\Provider\Privileges;
use Oscar\Service\OrganizationService;
use Oscar\Utils\EntityHydrator;
use Oscar\Utils\UnicaenDoctrinePaginator;
@@ -51,6 +52,8 @@ class OrganizationController extends AbstractOscarController

    public function deleteAction(){

        $this->getOscarUserContext()->check(Privileges::ORGANIZATION_DELETE);

        $id = $this->params()->fromRoute('id');
        $organization = $this->getOrganizationService()->getOrganization($id);