This commit is contained in:
afornerot 2019-11-27 10:13:43 +01:00
parent 4717b95efd
commit 774fb08894
6 changed files with 379 additions and 13 deletions

View File

@ -29,8 +29,13 @@
<variable name="activer_adminer" type="oui/non" description="Activer Adminer" hidden='True' exists='False'><value>non</value></variable>
<variable name="activer_balado" type="oui/non" description="Activer Balado" hidden='True' exists='False'><value>non</value></variable>
<variable name="activer_dokuwiki" type="oui/non" description="Activer Dokuwiki" hidden='True' exists='False'><value>non</value></variable>
<variable name="activer_econnect" type="oui/non" description="Activer eConnect" hidden='True' exists='False'><value>non</value></variable>
<variable name="activer_etherhome" type="oui/non" description="Activer Etherhome" hidden='True' exists='False'><value>non</value></variable>
<variable name="activer_gepi" type="oui/non" description="Activer GEPI" hidden='True' exists='False'><value>non</value></variable>
<variable name="activer_grr" type="oui/non" description="Activer Grr" hidden='True' exists='False'><value>non</value></variable>
<variable name="activer_kanboard" type="oui/non" description="Activer Kanboard" hidden='True' exists='False'><value>non</value></variable>
<variable name="activer_limesurvey" type="oui/non" description="Activer Limesurvey" hidden='True' exists='False'><value>non</value></variable>
<variable name="activer_mindmaps" type="oui/non" description="Activer Mindmaps" hidden='True' exists='False'><value>non</value></variable>
<variable name="activer_moodle" type="oui/non" description="Activer Moodle" hidden='True' exists='False'><value>non</value></variable>
<variable name="activer_nextcloud" type="oui/non" description="Activer Nextcloud" hidden='True' exists='False'><value>non</value></variable>
<variable name="activer_opensondage" type="oui/non" description="Activer Opensondage" hidden='True' exists='False'><value>non</value></variable>
@ -149,7 +154,25 @@
<variable type="oui/non" name='ninegate_activate_widdokuwiki' description='Activer Dokuwiki' mandatory='True'>
<value>non</value>
</variable>
<variable type='string' name='ninegate_widdokuwiki_url' description='URL complète de votre dokuwiki' mandatory='True' />
<variable type='string' name='ninegate_widdokuwiki_url' description='URL complète de votre Dokuwiki' mandatory='True' />
<!-- ECONNECT -->
<variable type="oui/non" name='ninegate_activate_wideconnect' description='Activer eConnect' mandatory='True'>
<value>non</value>
</variable>
<variable type='string' name='ninegate_wideconnect_url' description='URL complète de votre eConnect' mandatory='True' />
<!-- ETHERHOME -->
<variable type="oui/non" name='ninegate_activate_widetherhome' description='Activer Etherhome' mandatory='True'>
<value>non</value>
</variable>
<variable type='string' name='ninegate_widetherhome_url' description='URL complète de votre Etherhome' mandatory='True' />
<!-- GEPI -->
<variable type="oui/non" name='ninegate_activate_widgepi' description='Activer GEPI' mandatory='True'>
<value>non</value>
</variable>
<variable type='string' name='ninegate_widgepi_url' description='URL complète de votre GEPI' mandatory='True' />
<!-- GRR -->
<variable type="oui/non" name='ninegate_activate_widgrr' description='Activer Grr' mandatory='True'>
@ -157,6 +180,12 @@
</variable>
<variable type='string' name='ninegate_widgrr_url' description='URL complète de votre Grr' mandatory='True' />
<!-- KANBOARD -->
<variable type="oui/non" name='ninegate_activate_widkanboard' description='Activer Kanboard' mandatory='True'>
<value>non</value>
</variable>
<variable type='string' name='ninegate_widkanboard_url' description='URL complète de votre Kanboard' mandatory='True' />
<!-- LIMESURVEY -->
<variable type="oui/non" name='ninegate_activate_widlimesurvey' description='Activer Limesurvey' mandatory='True'>
<value>non</value>
@ -166,6 +195,12 @@
<variable type='string' name='ninegate_widlimesurvey_apikey' description='API Key de votre Limesurvey' mandatory='True' />
<variable type='string' name='ninegate_widlimesurvey_syncenvole' description='URL Posh-Profil pour synchronisation Limesurvey' mandatory='True' />
<!-- MINDMAPS -->
<variable type="oui/non" name='ninegate_activate_widmindmaps' description='Activer Mindmaps' mandatory='True'>
<value>non</value>
</variable>
<variable type='string' name='ninegate_widmindmaps_url' description='URL complète de votre Mindmaps' mandatory='True' />
<!-- MOODLE -->
<variable type="oui/non" name='ninegate_activate_widmoodle' description='Activer Moodle' mandatory='True'>
<value>non</value>
@ -257,8 +292,13 @@
<separator name="ninegate_activate_widadminer">Paramètres associés à Adminer</separator>
<separator name="ninegate_activate_widbalado">Paramètres associés à Balado</separator>
<separator name="ninegate_activate_widdokuwiki">Paramètres associés à Dokuwiki</separator>
<separator name="ninegate_activate_wideconnect">Paramètres associés à eConnect</separator>
<separator name="ninegate_activate_widetherhome">Paramètres associés à Etherhome</separator>
<separator name="ninegate_activate_widgepi">Paramètres associés à GEPI</separator>
<separator name="ninegate_activate_widgrr">Paramètres associés à Grr</separator>
<separator name="ninegate_activate_widkanboard">Paramètres associés à Kanboard</separator>
<separator name="ninegate_activate_widlimesurvey">Paramètres associés à Limesurvey</separator>
<separator name="ninegate_activate_widmindmaps">Paramètres associés à Mindmaps</separator>
<separator name="ninegate_activate_widmoodle">Paramètres associés à Moodle</separator>
<separator name="ninegate_activate_widnextcloud">Paramètres associés à Nextcloud</separator>
<separator name="ninegate_activate_widonlyoffice">Paramètres associés à Only Office</separator>
@ -407,8 +447,13 @@
<target type='variable'>ninegate_activate_widadminer</target>
<target type='variable'>ninegate_activate_widbalado</target>
<target type='variable'>ninegate_activate_widdokuwiki</target>
<target type='variable'>ninegate_activate_wideconnect</target>
<target type='variable'>ninegate_activate_widetherhome</target>
<target type='variable'>ninegate_activate_widgepi</target>
<target type='variable'>ninegate_activate_widgrr</target>
<target type='variable'>ninegate_activate_widkanboard</target>
<target type='variable'>ninegate_activate_widlimesurvey</target>
<target type='variable'>ninegate_activate_widmindmaps</target>
<target type='variable'>ninegate_activate_widmoodle</target>
<target type='variable'>ninegate_activate_widnextcloud</target>
<target type='variable'>ninegate_activate_widonlyoffice</target>
@ -534,6 +579,78 @@
<!-- AFFICHAGE EN FONCTION DU WIDGET ECONNECT -->
<fill name='calc_multi_condition' target='ninegate_activate_wideconnect'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_econnect</param>
<param name='match'>oui</param>
<param name='mismatch'>non</param>
<param name='default_mismatch'>non</param>
</fill>
<condition name='hidden_if_in' source='ninegate_activate_wideconnect'>
<param>non</param>
<target type='variable'>ninegate_wideconnect_url</target>
</condition>
<fill name='calc_multi_condition' target='ninegate_wideconnect_url'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_econnect</param>
<param name='match'>/econnect</param>
<param name='default_mismatch'>None</param>
</fill>
<!-- AFFICHAGE EN FONCTION DU WIDGET ETHERHOME -->
<fill name='calc_multi_condition' target='ninegate_activate_widetherhome'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_etherhome</param>
<param name='match'>oui</param>
<param name='mismatch'>non</param>
<param name='default_mismatch'>non</param>
</fill>
<condition name='hidden_if_in' source='ninegate_activate_widetherhome'>
<param>non</param>
<target type='variable'>ninegate_widetherhome_url</target>
</condition>
<fill name='calc_multi_condition' target='ninegate_widetherhome_url'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_etherhome</param>
<param name='match'>/etherhome</param>
<param name='default_mismatch'>None</param>
</fill>
<!-- AFFICHAGE EN FONCTION DU WIDGET GEPI -->
<fill name='calc_multi_condition' target='ninegate_activate_widgepi'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_gepi</param>
<param name='match'>oui</param>
<param name='mismatch'>non</param>
<param name='default_mismatch'>non</param>
</fill>
<condition name='hidden_if_in' source='ninegate_activate_widgepi'>
<param>non</param>
<target type='variable'>ninegate_widgepi_url</target>
</condition>
<fill name='calc_multi_condition' target='ninegate_widgepi_url'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_gepi</param>
<param name='match'>/gepi</param>
<param name='default_mismatch'>None</param>
</fill>
<!-- AFFICHAGE EN FONCTION DU WIDGET GRR -->
<fill name='calc_multi_condition' target='ninegate_activate_widgrr'>
<param>oui</param>
@ -558,6 +675,30 @@
<!-- AFFICHAGE EN FONCTION DU WIDGET KANBOARD -->
<fill name='calc_multi_condition' target='ninegate_activate_widkanboard'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_kanboard</param>
<param name='match'>oui</param>
<param name='mismatch'>non</param>
<param name='default_mismatch'>non</param>
</fill>
<condition name='hidden_if_in' source='ninegate_activate_widkanboard'>
<param>non</param>
<target type='variable'>ninegate_widkanboard_url</target>
</condition>
<fill name='calc_multi_condition' target='ninegate_widkanboard_url'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_kanboard</param>
<param name='match'>/kanboard</param>
<param name='default_mismatch'>None</param>
</fill>
<!-- AFFICHAGE EN FONCTION DU WIDGET LIMESURVEY -->
<fill name='calc_multi_condition' target='ninegate_activate_widlimesurvey'>
<param>oui</param>
@ -606,6 +747,30 @@
<!-- AFFICHAGE EN FONCTION DU WIDGET MINDMAPS -->
<fill name='calc_multi_condition' target='ninegate_activate_widmindmaps'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_mindmaps</param>
<param name='match'>oui</param>
<param name='mismatch'>non</param>
<param name='default_mismatch'>non</param>
</fill>
<condition name='hidden_if_in' source='ninegate_activate_widmindmaps'>
<param>non</param>
<target type='variable'>ninegate_widmindmaps_url</target>
</condition>
<fill name='calc_multi_condition' target='ninegate_widmindmaps_url'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_mindmaps</param>
<param name='match'>/mindmaps</param>
<param name='default_mismatch'>None</param>
</fill>
<!-- AFFICHAGE EN FONCTION DU WIDGET MOODLE -->
<fill name='calc_multi_condition' target='ninegate_activate_widmoodle'>
<param>oui</param>

View File

@ -11,6 +11,8 @@ use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\DBAL\Connection as DBALConnection;
use Doctrine\ORM\EntityManager;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
use Cadoles\CoreBundle\Entity\Niveau01;
use Cadoles\CoreBundle\Entity\Niveau02;
@ -100,8 +102,8 @@ class OnlyCommand extends Command
$this->only_url = $this->container->getParameter("widonlyoffice_url")."/api/2.0/";
$this->only_host = str_replace("https://","",str_replace("http://","",$this->container->getParameter("widonlyoffice_url")));
//$this->only_url = "https://transnum.oo.ac-dijon.fr"."/api/2.0/";
//$this->only_host = "transnum.oo.ac-dijon.fr";
$this->only_url = "https://transnum.oo.ac-dijon.fr"."/api/2.0/";
$this->only_host = "transnum.oo.ac-dijon.fr";
$this->only_user = $this->container->getParameter("widonlyoffice_user");
$this->only_password = $this->container->getParameter("widonlyoffice_password");
@ -133,7 +135,7 @@ class OnlyCommand extends Command
$this->writeln('== AUTHENTIFICATION =================================');
\Unirest\Request::verifyPeer(false);
\Unirest\Request::verifyHost(false);
$headers = ['Host' => $this->only_host, 'Accept' => 'application/json','Content-Type'=>'application/json'];
$headers = ['Host' => $this->only_host, 'Accept' => 'application/json','Content-Type'=>'application/json','Retry-After'=>'5'];
$query = array('userName' => $this->only_user, 'password' => $this->only_password);
$body = \Unirest\Request\Body::json($query);
@ -143,14 +145,22 @@ class OnlyCommand extends Command
$headers["Authorization"]=$token;
// Synchronisation des utilisateur Only sur l'annuaire
/*
$this->writeln('');
$this->writeln('== SYNCHRONISATION ONLY==============================');
//$response = \Unirest\Request::get($this->only_url.'/settings/ldap/sync',$headers);
//if($this->koresponse($response)) return 0;
$response = \Unirest\Request::get($this->only_url.'/settings/ldap/sync',$headers);
if($this->koresponse($response)) return 0;
*/
// Fichier d'import des utilisateurs only inexistant dans ninegate
$this->filesystem->remove($this->rootlog.'toimportfromonly.csv');
$string="login;prenom;nom;email;niveau01;role";
$this->filesystem->appendToFile($this->rootlog.'toimportfromonly.csv', $string."\n");
// Controler les utilisateur only
$this->writeln('');
$this->writeln('== CONTROLE USER ONLY================================');
$onlyusers=[];
$response = \Unirest\Request::get($this->only_url.'/people',$headers);
if($this->koresponse($response)) return 0;
@ -158,10 +168,26 @@ class OnlyCommand extends Command
$user=$this->em->getRepository("CadolesCoreBundle:User")->findBy(["username"=>$onlyuser->userName]);
if(!$user) {
$this->writelnred("ERREUR ".$onlyuser->userName." existe dans OnlyOffice mais pas dans Ninegate");
if($onlyuser->lastName!="") {
$string=$onlyuser->userName.";".$onlyuser->firstName.";".$onlyuser->lastName.";".$onlyuser->email.";Autres;ROLE_USER";
//$this->filesystem->appendToFile($this->rootlog.'toimportfromonly.csv', $string."\n");
}
}
else {
// Sauvegarde l'id du useronlyoffice
$onlyusers[$onlyuser->id]=$onlyuser->userName;
}
}
$string=$onlyuser->userName.";".$onlyuser->firstName.";".$onlyuser->lastName.";".$onlyuser->email.";Autres;ROLE_USER";
$this->filesystem->appendToFile($this->rootlog.'toimportfromonly.csv', $string."\n");
}
$response = \Unirest\Request::get($this->only_url.'/people',$headers);
if($this->koresponse($response)) return 0;
dump($response);
// Controler les utilisateurs ninegate
/*
$this->writeln('');
$this->writeln('== CONTROLE USER NINEGATE============================');
$users=$this->em->getRepository("CadolesCoreBundle:User")->findAll();
@ -171,6 +197,94 @@ class OnlyCommand extends Command
$this->writelnred("ERREUR ".$user->getUsername()." existe dans Ninegate mais pas dans OnlyOffice");
}
}
*/
// On recherche la page template de group
$pagetemplate=$this->em->getRepository("CadolesPortalBundle:Page")->findOneBy(["parentfor"=>"group"]);
if(!$pagetemplate) {
$this->writelnred("ERREUR Pas de page modèle de type groupe");
return 1;
}
// Injection des groupes only non existant dans ninegate
$this->writeln('');
$this->writeln('== INJECTION DES GROUPES ONLY========================');
$response = \Unirest\Request::get($this->only_url.'/project?status=0,',$headers);
if($this->koresponse($response)) return 0;
foreach($response->body->response as $onlygroup) {
// Le groupe existe-t-il dans ninegate
$group=$this->em->getRepository("CadolesCoreBundle:Group")->findBy(["idonlyoffice"=>$onlygroup->id]);
if(!$group) {
$namegroup=$onlygroup->id." - ".$onlygroup->title;
// Ce nom de groupe existe-t-il déjà si oui erreur
$group=$this->em->getRepository("CadolesCoreBundle:Group")->findBy(["label"=>$namegroup]);
if($group)
$this->writelnred("ERREUR Groupe déjà existant = ".$namegroup);
else{
// Le propriétaire du groupe only existe-t-il dans ninegate
if(!array_key_exists($onlygroup->responsible->id,$onlyusers)) {
$this->writelnred("ERREUR Propriétaire du Groupe n'existe pas. Group = ".$namegroup. " - User = ".$onlygroup->responsible->displayName);
}
else {
// Création du groupe
$user=$this->em->getRepository("CadolesCoreBundle:User")->findOneBy(["username"=>$onlyusers[$onlygroup->responsible->id]]);
$this->writeln("Création du groupe Ninegate = ".$namegroup);
if(!$simulate) {
$group=new Group();
$group->setLabel($namegroup);
$group->setDescription($onlygroup->description);
$group->setFgopen(!$onlygroup->isPrivate);
$group->setFgcanshare(true);
$group->setFgcancreatepage(false);
$group->setFgcancreatecalendar(false);
$group->setFgcancreateblog(false);
$group->setFgall(false);
$group->setFgtemplate(false);
$group->setOwner($user);
$group->setIdonlyoffice($onlygroup->id);
$this->em->persist($group);
$this->em->flush();
// On ajoute le propriétaire en tant que membre du groupe
$this->addMember($group,$user,true);
// On controle que le groupe a bien page / calendrier / blog
$this->ctrlFgcanshare($group,$user,$pagetemplate);
}
// Rattachement des membres au groupe
$group=$this->em->getRepository("CadolesCoreBundle:Group")->findOneBy(["idonlyoffice"=>$onlygroup->id]);
$members = \Unirest\Request::get($this->only_url.'/project/'.$onlygroup->id.'/team',$headers);
if($this->koresponse($members)) return 0;
foreach($members->body->response as $member) {
// Si non propriétaire du groupe
if($member->userName!=$onlyusers[$onlygroup->responsible->id]) {
$user=$this->em->getRepository("CadolesCoreBundle:User")->findOneBy(["username"=>$member->userName]);
if(!$user) {
$this->writelnred("ERREUR Membre du group inexistant. Group = ".$namegroup." - ".$member->userName);
}
else {
$this->writeln("Rattachement utilisateur. Group = ".$namegroup." - User = ".$member->userName);
if(!$simulate&&$group) {
// On s'assure qu'il n'es pas déjà rattaché
$usergroup=$this->em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["user"=>$user,"group"=>$group]);
if(!$usergroup) {
$this->addMember($group,$user,false);
}
}
}
}
}
}
}
}
}
}
$this->writeln('');
@ -196,4 +310,61 @@ class OnlyCommand extends Command
}
private function addMember($group,$user,$fgmanager) {
$key = Uuid::uuid4();
$usergroup=new Usergroup;
$usergroup->setUser($user);
$usergroup->setGroup($group);
$usergroup->setFgmanager($fgmanager);
$usergroup->setKeyvalue($key);
$this->em->persist($usergroup);
$this->em->flush();
}
private function ctrlFgcanshare($group,$user,$pagetemplate) {
if($group->getFgcanshare()) {
// On regarde s'il a au moins une page
if($group->getPages()->isEmpty()) {
$page=$this->em->getRepository("CadolesPortalBundle:Page")->clonePage(null,$pagetemplate);
$group->addPage($page);
$page->setName($group->getLabel());
$page->setUser($user);
$this->em->persist($page);
$this->em->persist($group);
$this->em->flush();
}
// On regarde s'il a au moins un calendrier
if($group->getCalendars()->isEmpty()) {
$calendar=new Calendar();
$key = Uuid::uuid4();
$calendar->setName($group->getLabel());
$calendar->setKeyvalue($key);
$calendar->addGroup($group);
$calendar->setColor($group->getColor());
$calendar->setType(0);
$calendar->setUser($user);
$this->em->persist($calendar);
$this->em->flush();
}
// On regarde s'il a au moins un blog
if($group->getBlogs()->isEmpty()) {
$blog=new Blog();
$blog->setName($group->getLabel());
$blog->addGroup($group);
$blog->setUser($user);
$this->em->persist($blog);
$this->em->flush();
}
}
}
}

View File

@ -54,17 +54,17 @@ class Group
private $fgcanshare;
/**
* @ORM\Column(type="boolean", options={"default" : true})
* @ORM\Column(type="boolean", options={"default" : false})
*/
private $fgcancreatepage;
/**
* @ORM\Column(type="boolean", options={"default" : true})
* @ORM\Column(type="boolean", options={"default" : false})
*/
private $fgcancreateblog;
/**
* @ORM\Column(type="boolean", options={"default" : true})
* @ORM\Column(type="boolean", options={"default" : false})
*/
private $fgcancreatecalendar;
@ -88,6 +88,11 @@ class Group
*/
private $attributes;
/**
* @ORM\Column(type="string", length=250, nullable=true)
*/
private $idonlyoffice;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\PortalBundle\Entity\Icon", inversedBy="groups")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
@ -430,6 +435,30 @@ class Group
return $this->attributes;
}
/**
* Set idonlyoffice
*
* @param string $idonlyoffice
*
* @return Group
*/
public function setIdonlyoffice($idonlyoffice)
{
$this->idonlyoffice = $idonlyoffice;
return $this;
}
/**
* Get idonlyoffice
*
* @return string
*/
public function getIdonlyoffice()
{
return $this->idonlyoffice;
}
/**
* Add user
*

View File

@ -243,7 +243,6 @@ class PagetemplateController extends Controller
}
// Retour
dump("retdirect to".$this->generateUrl($this->routeprimary));
return $this->redirect($this->generateUrl($this->routeprimary));
}

View File

@ -64,7 +64,7 @@
<div class="grid-item-title">
{{ group.title }}
<h2>{{ group.title }}</h2>
</div>
</div>
</a>

View File

@ -214,6 +214,7 @@
{% endif %}
$(document).ready(function(){
/*
if (CKEDITOR.instances["chat_message"]) CKEDITOR.instances["chat_message"].destroy();
if (CKEDITOR.instances["chat_messagemail"]) CKEDITOR.instances["chat_messagemail"].destroy();
@ -236,7 +237,8 @@
height: 150
});
},1000);
*/
$(".switch").bootstrapSwitch();
$("#mymodal-sendmail").removeAttr("tabindex");