Commit be1ee842 by Julien Jorry

BO : add page(s) admin + fix role admin for super admin

parent 37824fac
...@@ -355,8 +355,8 @@ services: ...@@ -355,8 +355,8 @@ services:
tags: tags:
- name: sonata.admin - name: sonata.admin
manager_type: orm manager_type: orm
group: "Pages" group: "Import"
label: "Pages" label: "Import"
show_mosaic_button: false show_mosaic_button: false
public: true public: true
......
...@@ -12,7 +12,6 @@ use App\Enum\MoyenEnum; ...@@ -12,7 +12,6 @@ use App\Enum\MoyenEnum;
use FOS\UserBundle\Event\FilterUserResponseEvent; use FOS\UserBundle\Event\FilterUserResponseEvent;
use FOS\UserBundle\FOSUserEvents; use FOS\UserBundle\FOSUserEvents;
use Knp\Menu\ItemInterface as MenuItemInterface; use Knp\Menu\ItemInterface as MenuItemInterface;
use Knp\Menu\ItemInterface;
use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Admin\AdminInterface; use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper;
......
...@@ -21,7 +21,9 @@ class GroupAdmin extends BaseGroupAdmin ...@@ -21,7 +21,9 @@ class GroupAdmin extends BaseGroupAdmin
protected function configureRoutes(RouteCollection $collection) protected function configureRoutes(RouteCollection $collection)
{ {
$subject = $this->getSubject(); $subject = $this->getSubject();
$collection->clearExcept('list'); if ($subject != null && !($subject->isGranted('ROLE_SUPER_ADMIN') || $subject->isGranted('ROLE_ADMIN_SIEGE'))) {
$collection->clearExcept('list');
}
} }
public function getBatchActions() public function getBatchActions()
......
...@@ -213,39 +213,41 @@ class UserAdmin extends BaseUserAdmin ...@@ -213,39 +213,41 @@ class UserAdmin extends BaseUserAdmin
if ($subject->isGranted('ROLE_COMPTOIR') && !empty($subject->getComptoirsgere())) { if ($subject->isGranted('ROLE_COMPTOIR') && !empty($subject->getComptoirsgere())) {
$hideOrShowComptoir = []; $hideOrShowComptoir = [];
} }
$formMapper->with('Groups') $formMapper
->add('groups', ModelType::class, [ ->with('Groups')
'required' => false, ->add('groups', ModelType::class, [
'expanded' => true, 'required' => false,
'multiple' => true, 'expanded' => true,
]) 'multiple' => true,
->add('groupesgere', null, [ ])
'required' => false, ->add('groupesgere', null, [
'label' => 'Groupe local géré (obligatoire)', 'required' => false,
'attr' => $hideOrShowGroupe, 'label' => 'Groupe local géré (obligatoire)',
'label_attr' => $hideOrShowGroupe, 'attr' => $hideOrShowGroupe,
]) 'label_attr' => $hideOrShowGroupe,
->add('comptoirsgere', null, [ ])
'required' => false, ->add('comptoirsgere', null, [
'label' => 'Comptoir géré (obligatoire)', 'required' => false,
'attr' => $hideOrShowComptoir, 'label' => 'Comptoir géré (obligatoire)',
'label_attr' => $hideOrShowComptoir, 'attr' => $hideOrShowComptoir,
]) 'label_attr' => $hideOrShowComptoir,
->end(); ])
$formMapper->end(); ->end()
->with('Roles')
->add('realRoles', SecurityRolesType::class, [
'label' => 'form.label_roles',
'expanded' => true,
'multiple' => true,
'required' => false,
])
->end()
->end()
;
} }
// ->with('Roles') // ->with('Keys')
// ->add('realRoles', SecurityRolesType::class, [ // ->add('token', null, ['required' => false])
// 'label' => 'form.label_roles', // ->add('twoStepVerificationCode', null, ['required' => false])
// 'expanded' => true, // ->end()
// 'multiple' => true,
// 'required' => false,
// ])
// ->end()
// ->with('Keys')
// ->add('token', null, ['required' => false])
// ->add('twoStepVerificationCode', null, ['required' => false])
// ->end()
} }
public function getBatchActions() public function getBatchActions()
......
...@@ -267,7 +267,7 @@ abstract class Flux ...@@ -267,7 +267,7 @@ abstract class Flux
$em = $event->getEntityManager(); $em = $event->getEntityManager();
$flux->getExpediteur()->setCompte($compteExp); $flux->getExpediteur()->setCompte($compteExp);
$em->persist($flux->getExpediteur()); $em->persist($flux->getExpediteur());
if ($this->getParenttype() != 'vente') { if ($flux->getParenttype() != 'vente') {
$compteDest = $flux->getDestinataire()->getCompte() + $flux->getMontant(); $compteDest = $flux->getDestinataire()->getCompte() + $flux->getMontant();
$flux->getDestinataire()->setCompte($compteDest); $flux->getDestinataire()->setCompte($compteDest);
$em->persist($flux->getDestinataire()); $em->persist($flux->getDestinataire());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment