synchro only
This commit is contained in:
parent
3b1bff0710
commit
ee84ce033e
|
@ -102,9 +102,6 @@ class OnlyCommand extends Command
|
||||||
$this->only_url = $this->container->getParameter("widonlyoffice_url")."/api/2.0/";
|
$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_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_user = $this->container->getParameter("widonlyoffice_user");
|
$this->only_user = $this->container->getParameter("widonlyoffice_user");
|
||||||
$this->only_password = $this->container->getParameter("widonlyoffice_password");
|
$this->only_password = $this->container->getParameter("widonlyoffice_password");
|
||||||
|
|
||||||
|
@ -135,6 +132,7 @@ class OnlyCommand extends Command
|
||||||
$this->writeln('== AUTHENTIFICATION =================================');
|
$this->writeln('== AUTHENTIFICATION =================================');
|
||||||
\Unirest\Request::verifyPeer(false);
|
\Unirest\Request::verifyPeer(false);
|
||||||
\Unirest\Request::verifyHost(false);
|
\Unirest\Request::verifyHost(false);
|
||||||
|
\Unirest\Request::timeout(5);
|
||||||
$headers = ['Host' => $this->only_host, 'Accept' => 'application/json','Content-Type'=>'application/json','Retry-After'=>'5'];
|
$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);
|
$query = array('userName' => $this->only_user, 'password' => $this->only_password);
|
||||||
$body = \Unirest\Request\Body::json($query);
|
$body = \Unirest\Request\Body::json($query);
|
||||||
|
@ -145,12 +143,11 @@ class OnlyCommand extends Command
|
||||||
$headers["Authorization"]=$token;
|
$headers["Authorization"]=$token;
|
||||||
|
|
||||||
// Synchronisation des utilisateur Only sur l'annuaire
|
// Synchronisation des utilisateur Only sur l'annuaire
|
||||||
/*
|
|
||||||
$this->writeln('');
|
$this->writeln('');
|
||||||
$this->writeln('== SYNCHRONISATION ONLY==============================');
|
$this->writeln('== SYNCHRONISATION ONLY==============================');
|
||||||
$response = \Unirest\Request::get($this->only_url.'/settings/ldap/sync',$headers);
|
$response = \Unirest\Request::get($this->only_url.'/settings/ldap/sync',$headers);
|
||||||
if($this->koresponse($response)) return 0;
|
if($this->koresponse($response)) return 0;
|
||||||
*/
|
|
||||||
|
|
||||||
// Fichier d'import des utilisateurs only inexistant dans ninegate
|
// Fichier d'import des utilisateurs only inexistant dans ninegate
|
||||||
$this->filesystem->remove($this->rootlog.'toimportfromonly.csv');
|
$this->filesystem->remove($this->rootlog.'toimportfromonly.csv');
|
||||||
|
@ -160,34 +157,37 @@ class OnlyCommand extends Command
|
||||||
// Controler les utilisateur only
|
// Controler les utilisateur only
|
||||||
$this->writeln('');
|
$this->writeln('');
|
||||||
$this->writeln('== CONTROLE USER ONLY================================');
|
$this->writeln('== CONTROLE USER ONLY================================');
|
||||||
|
$kousers=[];
|
||||||
$onlyusers=[];
|
$onlyusers=[];
|
||||||
|
$start=0;
|
||||||
$response = \Unirest\Request::get($this->only_url.'/people',$headers);
|
$response = \Unirest\Request::get($this->only_url.'/people',$headers);
|
||||||
if($this->koresponse($response)) return 0;
|
if($this->koresponse($response)) return 0;
|
||||||
|
$peoples=$response->body->response;
|
||||||
|
while(isset($response->body->nextIndex)) {
|
||||||
|
$response = \Unirest\Request::get($this->only_url.'/people?startIndex='.$response->body->nextIndex,$headers);
|
||||||
|
if($this->koresponse($response)) return 0;
|
||||||
|
$peoples=array_merge($peoples,$response->body->response);
|
||||||
|
}
|
||||||
|
|
||||||
foreach($response->body->response as $onlyuser) {
|
foreach($peoples as $onlyuser) {
|
||||||
$user=$this->em->getRepository("CadolesCoreBundle:User")->findBy(["username"=>$onlyuser->userName]);
|
$user=$this->em->getRepository("CadolesCoreBundle:User")->findBy(["username"=>$onlyuser->userName]);
|
||||||
if(!$user) {
|
if(!$user) {
|
||||||
$this->writelnred("ERREUR ".$onlyuser->userName." existe dans OnlyOffice mais pas dans Ninegate");
|
$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";
|
$string=$onlyuser->userName.";".$onlyuser->firstName.";".$onlyuser->lastName.";".$onlyuser->email.";Autres;ROLE_USER";
|
||||||
//$this->filesystem->appendToFile($this->rootlog.'toimportfromonly.csv', $string."\n");
|
$this->filesystem->appendToFile($this->rootlog.'toimportfromonly.csv', $string."\n");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Sauvegarde l'id du useronlyoffice
|
// Sauvegarde l'id du useronlyoffice
|
||||||
$onlyusers[$onlyuser->id]=$onlyuser->userName;
|
$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);
|
$response = \Unirest\Request::get($this->only_url.'/people',$headers);
|
||||||
if($this->koresponse($response)) return 0;
|
if($this->koresponse($response)) return 0;
|
||||||
dump($response);
|
|
||||||
|
|
||||||
// Controler les utilisateurs ninegate
|
// Controler les utilisateurs ninegate
|
||||||
/*
|
|
||||||
$this->writeln('');
|
$this->writeln('');
|
||||||
$this->writeln('== CONTROLE USER NINEGATE============================');
|
$this->writeln('== CONTROLE USER NINEGATE============================');
|
||||||
$users=$this->em->getRepository("CadolesCoreBundle:User")->findAll();
|
$users=$this->em->getRepository("CadolesCoreBundle:User")->findAll();
|
||||||
|
@ -197,7 +197,7 @@ class OnlyCommand extends Command
|
||||||
$this->writelnred("ERREUR ".$user->getUsername()." existe dans Ninegate mais pas dans OnlyOffice");
|
$this->writelnred("ERREUR ".$user->getUsername()." existe dans Ninegate mais pas dans OnlyOffice");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// On recherche la page template de group
|
// On recherche la page template de group
|
||||||
$pagetemplate=$this->em->getRepository("CadolesPortalBundle:Page")->findOneBy(["parentfor"=>"group"]);
|
$pagetemplate=$this->em->getRepository("CadolesPortalBundle:Page")->findOneBy(["parentfor"=>"group"]);
|
||||||
|
@ -211,8 +211,14 @@ class OnlyCommand extends Command
|
||||||
$this->writeln('== INJECTION DES GROUPES ONLY========================');
|
$this->writeln('== INJECTION DES GROUPES ONLY========================');
|
||||||
$response = \Unirest\Request::get($this->only_url.'/project?status=0,',$headers);
|
$response = \Unirest\Request::get($this->only_url.'/project?status=0,',$headers);
|
||||||
if($this->koresponse($response)) return 0;
|
if($this->koresponse($response)) return 0;
|
||||||
foreach($response->body->response as $onlygroup) {
|
$projects=$response->body->response;
|
||||||
|
while(isset($response->body->nextIndex)) {
|
||||||
|
$response = \Unirest\Request::get($this->only_url.'/people?startIndex='.$response->body->nextIndex,$headers);
|
||||||
|
if($this->koresponse($response)) return 0;
|
||||||
|
$projects=array_merge($projects,$response->body->response);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($projects as $onlygroup) {
|
||||||
// Le groupe existe-t-il dans ninegate
|
// Le groupe existe-t-il dans ninegate
|
||||||
$group=$this->em->getRepository("CadolesCoreBundle:Group")->findBy(["idonlyoffice"=>$onlygroup->id]);
|
$group=$this->em->getRepository("CadolesCoreBundle:Group")->findBy(["idonlyoffice"=>$onlygroup->id]);
|
||||||
if(!$group) {
|
if(!$group) {
|
||||||
|
@ -223,6 +229,30 @@ class OnlyCommand extends Command
|
||||||
if($group)
|
if($group)
|
||||||
$this->writelnred("ERREUR Groupe déjà existant = ".$namegroup);
|
$this->writelnred("ERREUR Groupe déjà existant = ".$namegroup);
|
||||||
else{
|
else{
|
||||||
|
// Le propriétaire du groupe only existe-t-il dans ninegate
|
||||||
|
if(!array_key_exists($onlygroup->responsible->id,$onlyusers)) {
|
||||||
|
if(!array_key_exists($onlygroup->responsible->id,$kousers)) {
|
||||||
|
// Comme on n'a que les 1000 permiers lors du parcours des users only peut etre que lui fait partie de ceux que l'on n'a pas scanné
|
||||||
|
$respuser = \Unirest\Request::get($this->only_url.'/people/'.$onlygroup->responsible->id,$headers);
|
||||||
|
|
||||||
|
// Là normalement on a forcement une réponse positive
|
||||||
|
if(!$this->koresponse($respuser)) {
|
||||||
|
$onlyuser=$respuser->body->response;
|
||||||
|
$user=$this->em->getRepository("CadolesCoreBundle:User")->findBy(["username"=>$onlyuser->userName]);
|
||||||
|
if(!$user) {
|
||||||
|
$kousers[$onlygroup->responsible->id]=$onlygroup->responsible->displayName;
|
||||||
|
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Le propriétaire du groupe only existe-t-il dans ninegate
|
// Le propriétaire du groupe only existe-t-il dans ninegate
|
||||||
if(!array_key_exists($onlygroup->responsible->id,$onlyusers)) {
|
if(!array_key_exists($onlygroup->responsible->id,$onlyusers)) {
|
||||||
$this->writelnred("ERREUR Propriétaire du Groupe n'existe pas. Group = ".$namegroup. " - User = ".$onlygroup->responsible->displayName);
|
$this->writelnred("ERREUR Propriétaire du Groupe n'existe pas. Group = ".$namegroup. " - User = ".$onlygroup->responsible->displayName);
|
||||||
|
@ -237,7 +267,7 @@ class OnlyCommand extends Command
|
||||||
$group=new Group();
|
$group=new Group();
|
||||||
$group->setLabel($namegroup);
|
$group->setLabel($namegroup);
|
||||||
$group->setDescription($onlygroup->description);
|
$group->setDescription($onlygroup->description);
|
||||||
$group->setFgopen(!$onlygroup->isPrivate);
|
$group->setFgopen(false);
|
||||||
$group->setFgcanshare(true);
|
$group->setFgcanshare(true);
|
||||||
$group->setFgcancreatepage(false);
|
$group->setFgcancreatepage(false);
|
||||||
$group->setFgcancreatecalendar(false);
|
$group->setFgcancreatecalendar(false);
|
||||||
|
@ -267,6 +297,11 @@ class OnlyCommand extends Command
|
||||||
$user=$this->em->getRepository("CadolesCoreBundle:User")->findOneBy(["username"=>$member->userName]);
|
$user=$this->em->getRepository("CadolesCoreBundle:User")->findOneBy(["username"=>$member->userName]);
|
||||||
if(!$user) {
|
if(!$user) {
|
||||||
$this->writelnred("ERREUR Membre du group inexistant. Group = ".$namegroup." - ".$member->userName);
|
$this->writelnred("ERREUR Membre du group inexistant. Group = ".$namegroup." - ".$member->userName);
|
||||||
|
if(!array_key_exists($member->id,$kousers)) {
|
||||||
|
$kousers[$member->id]=$member->displayName;
|
||||||
|
$string=$member->userName.";".$member->firstName.";".$member->lastName.";".$member->email.";Autres;ROLE_USER";
|
||||||
|
$this->filesystem->appendToFile($this->rootlog.'toimportfromonly.csv', $string."\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->writeln("Rattachement utilisateur. Group = ".$namegroup." - User = ".$member->userName);
|
$this->writeln("Rattachement utilisateur. Group = ".$namegroup." - User = ".$member->userName);
|
||||||
|
@ -285,6 +320,147 @@ class OnlyCommand extends Command
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Injection des groupes ninegate non existant dans only
|
||||||
|
$this->writeln('');
|
||||||
|
$this->writeln('== INJECTION DES GROUPES NINEGATE====================');
|
||||||
|
$groups=$this->em->getRepository("CadolesCoreBundle:Group")->findBy(["fgcanshare"=>true]);
|
||||||
|
foreach($groups as $group) {
|
||||||
|
// Info du groupe
|
||||||
|
$grouptitle=$group->getLabel();
|
||||||
|
$groupdescription=$group->getDescription();
|
||||||
|
$groupowner=$group->getOwner();
|
||||||
|
$groupisprivate=true;
|
||||||
|
|
||||||
|
// Si pas de propriétaire de projet on le rattache à admin
|
||||||
|
if(!$groupowner)
|
||||||
|
$groupowner=$this->em->getRepository("CadolesCoreBundle:USer")->findBy(["username"=>"admin"]);
|
||||||
|
|
||||||
|
// Le groupe a un identifiant only, on le recherche via cet ID
|
||||||
|
if($group->getIdonlyoffice()) {
|
||||||
|
if(!$simulate) {
|
||||||
|
if($groupowner) {
|
||||||
|
// On recherche le propriétaire du groupe dans only
|
||||||
|
$respuser = \Unirest\Request::get($this->only_url.'/people/'.$groupowner->getUsername(),$headers);
|
||||||
|
|
||||||
|
// On recherche le groupe dans only
|
||||||
|
$respgroup = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice(),$headers);
|
||||||
|
|
||||||
|
// Là normalement on n'a forcement une réponse positive
|
||||||
|
if(!$this->koresponse($respuser)&&!$this->koresponse($respgroup)) {
|
||||||
|
// On regarde s'il y a des changement
|
||||||
|
if($respgroup->body->response->responsible->userName!=$groupowner->getUsername()||$respgroup->body->response->title!=$grouptitle||$respgroup->body->response->description!=$groupdescription||$respgroup->body->response->isPrivate!=$groupisprivate) {
|
||||||
|
$this->writeln("Modification du groupe dans Only. Group = ".$group->getLabel());
|
||||||
|
|
||||||
|
// On modifie le groupe only
|
||||||
|
$query = array('title' => $grouptitle, 'description' => $groupdescription, 'responsibleId' => $respuser->body->response->id, 'private' => $groupisprivate);
|
||||||
|
$body = \Unirest\Request\Body::json($query);
|
||||||
|
$respmodif = \Unirest\Request::put($this->only_url.'/project/'.$respgroup->body->response->id."/withSecurityInfo",$headers,$body);
|
||||||
|
if($this->koresponse($respmodif)) {
|
||||||
|
$this->writelnred("ERREUR SUR MODIFICATION du Group = ".$group->getLabel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sinon c'est que l'on doit le créer dans Only
|
||||||
|
else {
|
||||||
|
if(!$simulate) {
|
||||||
|
if($groupowner) {
|
||||||
|
// On recherche le propriétaire du groupe dans only
|
||||||
|
$respuser = \Unirest\Request::get($this->only_url.'/people/'.$groupowner->getUsername(),$headers);
|
||||||
|
|
||||||
|
// Là normalement on n'a forcement une réponse positive
|
||||||
|
if(!$this->koresponse($respuser)) {
|
||||||
|
|
||||||
|
$this->writeln("Création du groupe dans Only. Group = ".$group->getLabel());
|
||||||
|
$query = array(
|
||||||
|
'title' => $grouptitle,
|
||||||
|
'description' => $groupdescription,
|
||||||
|
'responsibleId' => $respuser->body->response->id,
|
||||||
|
'private' => $groupisprivate,
|
||||||
|
'notify' => true
|
||||||
|
);
|
||||||
|
$body = \Unirest\Request\Body::json($query);
|
||||||
|
$respsubmit = \Unirest\Request::post($this->only_url.'/project/withSecurity',$headers,$body);
|
||||||
|
if($this->koresponse($respsubmit)) {
|
||||||
|
$this->writelnred("ERREUR SUR CREATION du Group = ".$group->getLabel());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$group->setIdonlyoffice($respsubmit->body->response->id);
|
||||||
|
$this->em->persist($group);
|
||||||
|
$this->em->flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si pas d'erreur on doit avoir à présent le projet dans only rattaché à un groupe ninegate
|
||||||
|
// On va pouvoir s'occuper des membres du groupes
|
||||||
|
if($group->getIdonlyoffice()) {
|
||||||
|
// Liste des membres Ninegate
|
||||||
|
$membersNingate=[];
|
||||||
|
foreach($group->getUsers() as $member) {
|
||||||
|
array_push($membersNingate,$member->getUser()->getUsername());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Liste des membres Only
|
||||||
|
$membersOnly=[];
|
||||||
|
$respmember = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice().'/team',$headers);
|
||||||
|
if($this->koresponse($respmember)) {
|
||||||
|
$this->writelnred("ERREUR SUR RECUPERATION DES MEMBRES du Group = ".$group->getLabel());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach($respmember->body->response as $member) {
|
||||||
|
array_push($membersOnly,$member->userName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// On vérifie que chq membre Ninegate sont dans les membres Only et si pas le cas on le rattache
|
||||||
|
foreach($membersNingate as $member) {
|
||||||
|
if(!in_array($member,$membersOnly)) {
|
||||||
|
$this->writeln("Rattachement au groupe ".$group->getLabel()." l'utilisateur ".$member);
|
||||||
|
if(!$simulate) {
|
||||||
|
$respuser = \Unirest\Request::get($this->only_url.'/people/'.$member,$headers);
|
||||||
|
if($this->koresponse($respuser)) {
|
||||||
|
$this->writelnred("ERREUR Utilisateur inexistant dans only = ".$member);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$query = array('userId' => $respuser->body->response->id);
|
||||||
|
$body = \Unirest\Request\Body::json($query);
|
||||||
|
$respsubmit = \Unirest\Request::post($this->only_url.'/project/'.$group->getIdonlyoffice().'/team',$headers,$body);
|
||||||
|
if($this->koresponse($respsubmit)) {
|
||||||
|
$this->writelnred("ERREUR SUR RATACHEMENT");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// On vérifie que chq membre Ninegate sont dans les membres Only et si pas le cas on le rattache
|
||||||
|
foreach($membersOnly as $member) {
|
||||||
|
if(!in_array($member,$membersNingate)) {
|
||||||
|
$this->writeln("Detachement au groupe ".$group->getLabel()." l'utilisateur ".$member);
|
||||||
|
if(!$simulate) {
|
||||||
|
$respuser = \Unirest\Request::get($this->only_url.'/people/'.$member,$headers);
|
||||||
|
if($this->koresponse($respuser)) {
|
||||||
|
$this->writelnred("ERREUR Utilisateur inexistant dans only = ".$member);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$query = array('userId' => $respuser->body->response->id);
|
||||||
|
$body = \Unirest\Request\Body::json($query);
|
||||||
|
$respsubmit = \Unirest\Request::delete($this->only_url.'/project/'.$group->getIdonlyoffice().'/team',$headers,$body);
|
||||||
|
if($this->koresponse($respsubmit)) {
|
||||||
|
$this->writelnred("ERREUR SUR DETACHEMENT");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->writeln('');
|
$this->writeln('');
|
||||||
|
|
|
@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
|
||||||
(-100, 'DRAAF', '130007107');
|
(-100, 'DRAAF', '130007107');
|
||||||
|
|
||||||
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
|
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
|
||||||
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}7edyZMIwG4aTOpc6rVXCWrDljOW5K9xW
|
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}aTs3IqgN93ehIEqy93uWTTyxg5wNa+80
|
||||||
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
|
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -803,7 +803,14 @@ class UserController extends Controller
|
||||||
$error.="<p>Utilisateur = ".$user["login"]." existe déjà</p>";
|
$error.="<p>Utilisateur = ".$user["login"]." existe déjà</p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen($user["login"])<5) $error.="<p>Utilisateur = ".$user["login"]." login trop court doit être >= 5</p>";
|
// On s'assure que le login n'est pas trop court
|
||||||
|
if(strlen($user["login"])<5)
|
||||||
|
$error.="<p>Utilisateur = ".$user["login"]." login trop court doit être >= 5</p>";
|
||||||
|
|
||||||
|
// On s'assure que le username ne contient pas des caractères speciaux
|
||||||
|
$string = preg_replace('~[^@a-zA-Z0-9._-]~', '', $user["login"]);
|
||||||
|
if($string!=$user["login"])
|
||||||
|
$error.="<p>Utilisateur = ".$user["login"]." login avec caractères invalide</p>";
|
||||||
|
|
||||||
// On regarde si le email n'est pas déjà existant
|
// On regarde si le email n'est pas déjà existant
|
||||||
$userbdd=$em->getRepository('CadolesCoreBundle:User')->findOneBy(["email"=>$user["email"]]);
|
$userbdd=$em->getRepository('CadolesCoreBundle:User')->findOneBy(["email"=>$user["email"]]);
|
||||||
|
|
Loading…
Reference in New Issue