From 7142d163e495ca647dd27801fde27a27f440b10b Mon Sep 17 00:00:00 2001 From: Damien Moulard <dam.moulard@gmail.com> Date: Wed, 3 Apr 2024 12:08:18 +0200 Subject: [PATCH] allow tresorier to access adherents list and to ceil adherent emlc account --- fixtures/ssagirondepro/fixtures-ssagironde-pro.yaml | 3 ++- src/Admin/AdherentAdmin.php | 16 +++++++++++++--- src/Controller/AdherentAdminController.php | 2 +- src/Migrations/Version20240403114932.php | 31 +++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 src/Migrations/Version20240403114932.php diff --git a/fixtures/ssagirondepro/fixtures-ssagironde-pro.yaml b/fixtures/ssagirondepro/fixtures-ssagironde-pro.yaml index 848f557..7349f57 100644 --- a/fixtures/ssagirondepro/fixtures-ssagironde-pro.yaml +++ b/fixtures/ssagirondepro/fixtures-ssagironde-pro.yaml @@ -91,7 +91,8 @@ App\Entity\Usergroup: 'ROLE_ADMIN_OPERATION_GROUPE_GERER_ALL', 'ROLE_ADMIN_OPERATION_SIEGE_GERER_ALL', 'ROLE_ADMIN_HELLOASSO_ALL', - 'ROLE_ADMIN_DONS_ALL']] + 'ROLE_ADMIN_DONS_ALL', + 'ROLE_ADMIN_ADHERENT_GERER_LIST']] usergroup_gestiongroupe: __construct: ['Gestionnaire de Groupe', [ 'ROLE_GESTION_GROUPE', diff --git a/src/Admin/AdherentAdmin.php b/src/Admin/AdherentAdmin.php index 2f39384..2b27f76 100644 --- a/src/Admin/AdherentAdmin.php +++ b/src/Admin/AdherentAdmin.php @@ -583,7 +583,11 @@ class AdherentAdmin extends AbstractAdmin ->addIdentifier('user.email', null, ['label' => 'Email']) ; - $actions = ['edit' => []]; + if ($this->security->isGranted('ROLE_TRESORIER')) { + $actions = []; + } else { + $actions = ['edit' => []]; + } if (!$this->getConfigurationPool()->getContainer()->getParameter('tav_env')) { $listMapper ->add( @@ -604,8 +608,14 @@ class AdherentAdmin extends AbstractAdmin 'template' => '@kohinos/tav/list_user_tav_cotisation.html.twig', ] ); - if($this->getConfigurationPool()->getContainer()->getParameter('household_based_allowance') - && $this->security->isGranted('ROLE_SUPER_ADMIN') || $this->security->isGranted('ROLE_ADMIN_SIEGE')) { + if( + $this->getConfigurationPool()->getContainer()->getParameter('household_based_allowance') + && ( + $this->security->isGranted('ROLE_SUPER_ADMIN') + || $this->security->isGranted('ROLE_ADMIN_SIEGE') + || $this->security->isGranted('ROLE_TRESORIER') + ) + ) { $listMapper ->add( 'ceiling', diff --git a/src/Controller/AdherentAdminController.php b/src/Controller/AdherentAdminController.php index dfeb295..1bc7bb0 100644 --- a/src/Controller/AdherentAdminController.php +++ b/src/Controller/AdherentAdminController.php @@ -30,7 +30,7 @@ class AdherentAdminController extends CRUDController * * @param Request $request * @param Uuid $id Id du prestataire - * @IsGranted({"ROLE_SUPER_ADMIN", "ROLE_ADMIN_SIEGE"}) + * @IsGranted({"ROLE_SUPER_ADMIN", "ROLE_ADMIN_SIEGE", "ROLE_TRESORIER"}) * @return Response */ public function withdrawDownToTheCeilingAction(Request $request, $id): Response diff --git a/src/Migrations/Version20240403114932.php b/src/Migrations/Version20240403114932.php new file mode 100644 index 0000000..21b71a3 --- /dev/null +++ b/src/Migrations/Version20240403114932.php @@ -0,0 +1,31 @@ +<?php + +declare(strict_types=1); + +namespace DoctrineMigrations; + +use Doctrine\DBAL\Schema\Schema; +use Doctrine\Migrations\AbstractMigration; + +/** + * Auto-generated Migration: Please modify to your needs! + */ +final class Version20240403114932 extends AbstractMigration +{ + public function getDescription(): string + { + return ''; + } + + public function up(Schema $schema): void + { + // this up() migration is auto-generated, please modify it to your needs + $this->addSql('UPDATE usergroup SET roles = \'a:16:{i:0;s:14:"ROLE_TRESORIER";i:1;s:30:"ROLE_ADMIN_COMPTOIR_GERER_LIST";i:2;s:30:"ROLE_ADMIN_COMPTOIR_GERER_VIEW";i:3;s:30:"ROLE_ADMIN_ALL_COTISATIONS_ALL";i:4;s:32:"ROLE_ADMIN_ALL_ACHATSMONNAIE_ALL";i:5;s:33:"ROLE_ADMIN_RECONVERSION_GERER_ALL";i:6;s:30:"ROLE_ADMIN_TRANSFERT_GERER_ALL";i:7;s:40:"ROLE_ADMIN_ALL_DEMANDE_ACHATSMONNAIE_ALL";i:8;s:42:"ROLE_ADMIN_OPERATION_PRESTATAIRE_GERER_ALL";i:9;s:39:"ROLE_ADMIN_OPERATION_ADHERENT_GERER_ALL";i:10;s:39:"ROLE_ADMIN_OPERATION_COMPTOIR_GERER_ALL";i:11;s:37:"ROLE_ADMIN_OPERATION_GROUPE_GERER_ALL";i:12;s:36:"ROLE_ADMIN_OPERATION_SIEGE_GERER_ALL";i:13;s:24:"ROLE_ADMIN_HELLOASSO_ALL";i:14;s:19:"ROLE_ADMIN_DONS_ALL";i:15;s:30:"ROLE_ADMIN_ADHERENT_GERER_LIST";}\' WHERE name = "Trésorier"'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('UPDATE usergroup SET roles = \'a:15:{i:0;s:14:"ROLE_TRESORIER";i:1;s:30:"ROLE_ADMIN_COMPTOIR_GERER_LIST";i:2;s:30:"ROLE_ADMIN_COMPTOIR_GERER_VIEW";i:3;s:30:"ROLE_ADMIN_ALL_COTISATIONS_ALL";i:4;s:32:"ROLE_ADMIN_ALL_ACHATSMONNAIE_ALL";i:5;s:33:"ROLE_ADMIN_RECONVERSION_GERER_ALL";i:6;s:30:"ROLE_ADMIN_TRANSFERT_GERER_ALL";i:7;s:40:"ROLE_ADMIN_ALL_DEMANDE_ACHATSMONNAIE_ALL";i:8;s:42:"ROLE_ADMIN_OPERATION_PRESTATAIRE_GERER_ALL";i:9;s:39:"ROLE_ADMIN_OPERATION_ADHERENT_GERER_ALL";i:10;s:39:"ROLE_ADMIN_OPERATION_COMPTOIR_GERER_ALL";i:11;s:37:"ROLE_ADMIN_OPERATION_GROUPE_GERER_ALL";i:12;s:36:"ROLE_ADMIN_OPERATION_SIEGE_GERER_ALL";i:13;s:24:"ROLE_ADMIN_HELLOASSO_ALL";i:14;s:19:"ROLE_ADMIN_DONS_ALL";}\' WHERE name = "Trésorier"'); + } +} -- libgit2 0.26.0