pb reconf si non only

This commit is contained in:
afornerot 2020-06-24 09:48:57 +02:00
parent 8f85f5eb5e
commit d90d3039a2
3 changed files with 65 additions and 1 deletions

View File

@ -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();
}
}
}
}

View File

@ -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<br>";
foreach($data->getOwnergroups() as $group) {
$message.=" - <a href='".$this->generateUrl('cadoles_core_config_group_update', array('id'=>$group->getId()))."' target='_blank'>".$group->getLabel()."</a><br>";
}
$message.="<br>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();

View File

@ -321,6 +321,9 @@ parameters:
%end if
%else
activate_widonlyoffice: false
widonlyoffice_url:
widonlyoffice_user:
widonlyoffice_password:
widonlyoffice_sync: false
%end if