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 70b6a142..a47e47a7 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php @@ -1189,6 +1189,11 @@ class GroupController extends Controller $em->persist($pages[0]); $em->flush(); } + foreach($pages as $page) { + $page->setUser($group->getOwner()); + $em->persist($page); + $em->flush(); + } // On regarde s'il a au moins un calendrier if($group->getCalendars()->isEmpty()) { @@ -1212,6 +1217,11 @@ class GroupController extends Controller $em->persist($calendars[0]); $em->flush(); } + foreach($calendars as $calendar) { + $calendar->setUser($group->getOwner()); + $em->persist($calendar); + $em->flush(); + } } // On regarde s'il a au moins un blog @@ -1232,6 +1242,11 @@ class GroupController extends Controller $em->persist($blogs[0]); $em->flush(); } + foreach($blogs as $blog) { + $blog->setUser($group->getOwner()); + $em->persist($blog); + $em->flush(); + } } // On regarde s'il a au moins un project @@ -1252,6 +1267,11 @@ class GroupController extends Controller $em->persist($projects[0]); $em->flush(); } + foreach($projects as $project) { + $project->setUser($group->getOwner()); + $em->persist($project); + $em->flush(); + } } } } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php index fbbb416e..6aecf02b 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php @@ -702,7 +702,17 @@ class UserController extends Controller // Vérifier que cet enregistrement est supprimable if($this->GetParameter("masteridentity")=="LDAP") - throw $this->createNotFoundException('Permission denied'); + throw $this->createNotFoundException('Permission denied'); + + // Alerte si utilisateur propriétaire de groupe + if(!$data->getOwnergroups()->isEmpty()) { + $message ="ATTENTION CET UTILSATEUR EST PROPRIETAIRE DES GROUPES DE TRAVAIL SUIVANT
"; + foreach($data->getOwnergroups() as $group) { + $message.=" - $group->getId()))."' target='_blank'>".$group->getLabel()."
"; + } + $message.="
En le supprimant les groupes en question n'auront plus de propriétaire"; + $request->getSession()->getFlashBag()->add("notice", $message); + } // Création du formulaire $form = $this->createForm(UserType::class,$data,array( @@ -722,6 +732,37 @@ class UserController extends Controller // Sur validation if ($form->get('submit')->isClicked() && $form->isValid()) { + // Avant de supprimer l'utilisateur on passe à vide l'ensemble des groupes propriétaire à vide + foreach($data->getOwnergroups() as $group) { + $pages=$group->getPages(); + foreach($pages as $page) { + $page->setUser(null); + $em->persist($page); + $em->flush(); + } + + $blogs=$group->getBlogs(); + foreach($blogs as $blog) { + $blog->setUser(null); + $em->persist($blog); + $em->flush(); + } + + $calendars=$group->getCalendars(); + foreach($calendars as $calendar) { + $calendar->setUser(null); + $em->persist($calendar); + $em->flush(); + } + + $projects=$group->getProjects(); + foreach($projects as $project) { + $project->setUser(null); + $em->persist($project); + $em->flush(); + } + } + $em->remove($data); $em->flush(); diff --git a/tmpl/ninegate-template.yml b/tmpl/ninegate-template.yml index 480e5a95..6f476cc1 100644 --- a/tmpl/ninegate-template.yml +++ b/tmpl/ninegate-template.yml @@ -321,6 +321,9 @@ parameters: %end if %else activate_widonlyoffice: false + widonlyoffice_url: + widonlyoffice_user: + widonlyoffice_password: widonlyoffice_sync: false %end if