From 1eacaeea9a529ef3f339de5d21519130f63a97e8 Mon Sep 17 00:00:00 2001 From: afornerot Date: Mon, 16 Dec 2019 17:03:53 +0100 Subject: [PATCH] =?UTF-8?q?pb=20sur=20propri=C3=A9taire=20de=20groupe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CoreBundle/Controller/GroupController.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php index f26ac5df..7dbc9c04 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php @@ -703,6 +703,7 @@ class GroupController extends Controller $data->setFgtemplate(false); if($data->getLdapfilter()!="") $data->setFgopen(false); if($data->getAttributes()!="") $data->setFgopen(false); + if($access=="user") $data->setOwner($this->getUser()); // Icon $idicon = $form->get('idicon')->getData(); @@ -713,20 +714,6 @@ class GroupController extends Controller $em->persist($data); $em->flush(); - // Si acces par user on ajoute forcement le owner comme membre du groupe en tant que manager - /* - if($access=="user") { - $key = Uuid::uuid4(); - $usergroup=new Usergroup; - $usergroup->setUser($this->getUser()); - $usergroup->setGroup($data); - $usergroup->setFgmanager(true); - $usergroup->setKeyvalue($key); - $em->persist($usergroup); - $em->flush(); - } - */ - // On s'assure que le propriétaire est bien membre du groupe $this->ctrlOwner($data); @@ -932,7 +919,7 @@ class GroupController extends Controller protected function ctrlOwner($group) { $em = $this->getDoctrine()->getManager(); if($group->getOwner()) { - $usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["user"=>$group->getOwner()]); + $usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$group->getOwner()]); if(!$usergroup) { $key = Uuid::uuid4(); $usergroup=new Usergroup; @@ -1038,7 +1025,7 @@ class GroupController extends Controller if($tmp) $form->addError(new FormError('Un niveau de rang 02 utilise déjà ce label')); // On s'assure que le label ne contient pas des caractères speciaux - $string = preg_replace('~[^@a-zA-Z0-9._-]~', '', $data->getLabel()); + $string = preg_replace('~[^ @a-zA-Z0-9._-]~', '', $data->getLabel()); if($string!=$data->getLabel()) { $form->addError(new FormError('Caractères interdit dans ce label'));