This commit is contained in:
afornerot 2019-11-21 10:40:15 +01:00
parent 4b83534c09
commit 2d640dc09a
7 changed files with 96 additions and 44 deletions

View File

@ -40,7 +40,7 @@
"symfony/symfony": "3.4.*", "symfony/symfony": "3.4.*",
"tetranz/select2entity-bundle": "2.*", "tetranz/select2entity-bundle": "2.*",
"thecsea/simple-caldav-client": "^0.1.10", "thecsea/simple-caldav-client": "^0.1.10",
"mashape/unirest-php": "2.*", "mashape/unirest-php": "3.*",
"twig/twig": "^1.0||^2.0" "twig/twig": "^1.0||^2.0"
}, },
"require-dev": { "require-dev": {

View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "5c29a0c1698bd753d6b42df4822e5f2d", "hash": "e008822a96a469e24963e22d66f34c98",
"content-hash": "51482d6b9f9c27b385c17393182e0d82", "content-hash": "589f314a10ca56596cf580254885bd7c",
"packages": [ "packages": [
{ {
"name": "cboden/ratchet", "name": "cboden/ratchet",
@ -2409,31 +2409,33 @@
}, },
{ {
"name": "mashape/unirest-php", "name": "mashape/unirest-php",
"version": "v2.6.6", "version": "v3.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Mashape/unirest-php.git", "url": "https://github.com/Mashape/unirest-php.git",
"reference": "73c2d903232bb5a125396e606b67314a87b8b21c" "reference": "842c0f242dfaaf85f16b72e217bf7f7c19ab12cb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Mashape/unirest-php/zipball/73c2d903232bb5a125396e606b67314a87b8b21c", "url": "https://api.github.com/repos/Mashape/unirest-php/zipball/842c0f242dfaaf85f16b72e217bf7f7c19ab12cb",
"reference": "73c2d903232bb5a125396e606b67314a87b8b21c", "reference": "842c0f242dfaaf85f16b72e217bf7f7c19ab12cb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-curl": "*", "ext-curl": "*",
"ext-json": "*",
"php": ">=5.4.0" "php": ">=5.4.0"
}, },
"require-dev": { "require-dev": {
"codeclimate/php-test-reporter": "0.1.*", "codeclimate/php-test-reporter": "0.1.*",
"phpunit/phpunit": "~4.4" "phpunit/phpunit": "~4.4"
}, },
"suggest": {
"ext-json": "Allows using JSON Bodies for sending and parsing requests"
},
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-0": { "psr-0": {
"Unirest": "src" "Unirest\\": "src/"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -2449,7 +2451,7 @@
"https", "https",
"rest" "rest"
], ],
"time": "2016-02-16 16:45:52" "time": "2016-08-11 17:49:21"
}, },
{ {
"name": "monolog/monolog", "name": "monolog/monolog",

View File

@ -8,6 +8,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\DBAL\Connection as DBALConnection; use Doctrine\DBAL\Connection as DBALConnection;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
@ -24,6 +25,7 @@ use Unirest\Request;
global $bdd01; global $bdd01;
global $config; global $config;
class OnlyCommand extends Command class OnlyCommand extends Command
{ {
private $container; private $container;
@ -83,26 +85,21 @@ class OnlyCommand extends Command
$this->only_sync = true; $this->only_sync = true;
$this->only_url = "https://transnum.oo.pp.ac-dijon.fr"."/api/2.0/"; $this->only_url = "https://transnum.oo.pp.ac-dijon.fr"."/api/2.0/";
$this->only_url = "https://transnum.oo.ac-dijon.fr"."/api/2.0/";
$this->only_user = "admin"; $this->only_user = "admin";
$this->only_password = "brigitte89!"; $this->only_password = "brigitte89!";
$im = new \Imagick();
$im->setResolution(350, 350);
$im->readImage("/var/www/html/ninegate/uploads/file/widget-308/essai.csv[0]");
$im->setImageBackgroundColor('#ffffff');
$im = $im->flattenImages();
$im->setImageFormat('jpeg');
$im->writeImage("/var/www/html/ninegate/uploads/file/widget-308/toto.jpg");
return 1;
if($this->only_sync) { if($this->only_sync) {
//$client= new curl();
// Only Office est-il dans le domaine // Only Office est-il dans le domaine
if(stripos($this->only_url,"/")===0) if(stripos($this->only_url,"/")===0)
$this->only_url="https://".$this->container->getParameter("weburl").$this->only_url; $this->only_url="https://".$this->container->getParameter("weburl").$this->only_url;
$indomaine = (stripos($this->only_url,$this->container->getParameter("weburl"))!==false); $indomaine = (stripos($this->only_url,$this->container->getParameter("weburl"))!==false);
// Si hors domaine on utilise le proxy si proxy il y a // Si hors domaine on utilise le proxy si proxy il y a
if(!$indomaine) { if(!$indomaine) {
$PROXYactivate = $this->em->getRepository("CadolesCoreBundle:Config")->find("PROXYactivate")->getValue(); $PROXYactivate = $this->em->getRepository("CadolesCoreBundle:Config")->find("PROXYactivate")->getValue();
if($PROXYactivate) { if($PROXYactivate) {
@ -111,18 +108,66 @@ class OnlyCommand extends Command
\Unirest\Request::proxy($PROXYserver, $PROXYport, CURLPROXY_HTTP, true); \Unirest\Request::proxy($PROXYserver, $PROXYport, CURLPROXY_HTTP, true);
} }
} }
// Récupération des informations utilisateurs issus du masteridentity // Authentification à onlyoffice
$headers = ['Accept' => 'application/json']; $this->writeln('');
$this->writeln('== AUTHENTIFICATION =================================');
\Unirest\Request::verifyPeer(false);
\Unirest\Request::verifyHost(false);
$headers = ['Host' => 'transnum.oo.ac-dijon.fr', 'Accept' => 'application/json','Content-Type'=>'application/json'];
$query = array('userName' => $this->only_user, 'password' => $this->only_password); $query = array('userName' => $this->only_user, 'password' => $this->only_password);
$body = json_encode($query); $body = \Unirest\Request\Body::json($query);
$response = \Unirest\Request::post($this->only_url.'/authentication',$headers,$body);
$response = \Unirest\Request::post($this->only_url.'/authentication',$headers,$body);
if($this->koresponse($response)) return 0;
$token=$response->body->response->token;
$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;
// Controler les utilisateur only
$this->writeln('');
$this->writeln('== CONTROLE USER ONLY================================');
$response = \Unirest\Request::get($this->only_url.'/people',$headers);
if($this->koresponse($response)) return 0;
foreach($response->body->response as $onlyuser) {
$user=$this->em->getRepository("CadolesCoreBundle:User")->findBy(["username"=>$onlyuser->userName]);
if(!$user) {
$this->writelnred("ERREUR ".$onlyuser->userName." existe dans OnlyOffice mais pas dans Ninegate");
}
}
// Controler les utilisateurs ninegate
$this->writeln('');
$this->writeln('== CONTROLE USER NINEGATE============================');
$users=$this->em->getRepository("CadolesCoreBundle:User")->findAll();
foreach($users as $user) {
$response = \Unirest\Request::get($this->only_url.'/people/'.$user->getUsername(),$headers);
if($this->koresponse($response)) {
$this->writelnred("ERREUR ".$user->getUsername()." existe dans Ninegate mais pas dans OnlyOffice");
}
}
} }
$this->writeln(''); $this->writeln('');
return 1; return 1;
} }
function koresponse($response) {
if($response->code>=Response::HTTP_BAD_REQUEST) {
$this->writelnred("ERREUR ".$response->code);
if(property_exists($response,"body") && property_exists($response->body,"error")) $this->writelnred("ERREUR ".$response->body->error->message);;
return true;
}
return false;
}
private function writelnred($string) { private function writelnred($string) {
$this->output->writeln('<fg=red>'.$string.'</>'); $this->output->writeln('<fg=red>'.$string.'</>');
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n"); $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");

View File

@ -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}oIZgb8jC4L72wg4rgK+xfzdfPiy2Z8BA (-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}lq8Ffm9MG+azcCnLde4qj0KU0j3XFO8/
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');

View File

@ -702,8 +702,8 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setDescription("Conversation instantanée"); $entityWidget->setDescription("Conversation instantanée");
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_chat"); $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_chat");
$entityWidget->setHeight("1000"); $entityWidget->setHeight("1000");
$entityWidget->setAutoajust(false); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(false);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]); $entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": []}'); $parameter = json_decode('{"fields": []}');
@ -869,37 +869,37 @@ class InitDataCommand extends ContainerAwareCommand
$entityPage->setId(-110); $entityPage->setId(-110);
$entityPage->setRowOrder(0); $entityPage->setRowOrder(0);
$entityPage->setName('Accueil Groupe'); $entityPage->setName('Accueil Groupe');
$entityPage->setParentfor('Groupe'); $entityPage->setParentfor('group');
$entityPage->setMaxwidth(1500); $entityPage->setMaxwidth(0);
$entityPage->setPagecategory($entityPagecategory); $entityPage->setPagecategory($entityPagecategory);
$entityPage->setTemplate('{"rows":[{"id":0,"cols":[{"id":0,"size": 4,"rows":[]},{"id":1,"size": 8,"rows":[{"id":0,"cols":[{"id":0,"size": 12}]},{"id":1,"cols":[{"id":0,"size": 6},{"id":1,"size": 6}]}]}]}]}'); $entityPage->setTemplate('{"rows":[{"id":0,"cols":[{"id":0,"size": 3,"rows":[]},{"id":1,"size": 6,"rows":[{"id":0,"cols":[{"id":0,"size": 6},{"id":1,"size": 6}]}]},{"id":2,"size": 3,"rows":[]}]}]}');
$em->persist($entityPage); $em->persist($entityPage);
$em->flush(); $em->flush();
// Widget Nos Liens // Widget Nos Liens
$fields=["fields"=>[["id"=>"modedesktop","value"=>2]]]; $fields=["fields"=>[["id"=>"modedesktop","value"=>2]]];
$this->addWidget(-120,$entityPage,-1960,"R1C1",1,"Nos Liens",true,$fields); $this->addWidget(-120,$entityPage,-1960,"R1C2R1C1",0,"Nos Liens",true,$fields);
// Widget Nos Fichiers // Widget Nos Fichiers
$fields=["fields"=>[]]; $fields=["fields"=>[]];
$this->addWidget(-130,$entityPage,-1920,"R1C1",2,"Nos Fichiers",true,$fields); $this->addWidget(-130,$entityPage,-1920,"R1C2R1C2",0,"Nos Fichiers",true,$fields);
// Widget Info Page // Widget Info Page
$fields=["fields"=>[]]; $fields=["fields"=>[]];
$this->addWidget(-140,$entityPage,-1860,"R1C1",3,"Information Page",true,$fields); $this->addWidget(-140,$entityPage,-1860,"R1C1",0,"Information Page",true,$fields);
// Widget Notre Blog // Widget Notre Blog
$fields=["fields"=>[["id"=>"nbarticle","value"=>5]]]; $fields=["fields"=>[["id"=>"nbarticle","value"=>5]]];
$this->addWidget(-150,$entityPage,-1890,"R1C2R1C1",1,"Notre Blog",false,$fields); $this->addWidget(-150,$entityPage,-1890,"R1C2",0,"Notre Blog",false,$fields);
// Widget Notre Calendrier // Widget Notre Calendrier
$fields=["fields"=>[["id"=>"nbday","value"=>30]]]; $fields=["fields"=>[["id"=>"nbday","value"=>30]]];
$this->addWidget(-160,$entityPage,-1900,"R1C2R2C1",1,"Notre Calendrier",true,$fields); $this->addWidget(-160,$entityPage,-1900,"R1C2R1C1",1,"Notre Calendrier",true,$fields);
// Chat // Chat
$fields=["fields"=>[]]; $fields=["fields"=>[]];
$this->addWidget(-170,$entityPage,-1840,"R1C2R2C2",1,"Chat",true,$fields); $this->addWidget(-170,$entityPage,-1840,"R1C3",0,"Chat",false,$fields);
} }
$output->writeln(''); $output->writeln('');

View File

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

View File

@ -3,18 +3,22 @@
{% block localstyle %} {% block localstyle %}
{% if framed %} {% if framed %}
{% if border %} {% if border %}
#page-wrapper:last-of-type { #topchat {
//padding: 5px 25px 10px 15px; margin: 5px -15px 5px -25px;
//background: transparent;
} }
.mychat{
margin: 0px 0px 0px -10px;
}
{% else %} {% else %}
#page-wrapper { #topchat {
padding: 5px 25px 0px 15px; margin: 5px -30px;
//background: transparent; }
.mychat{
margin: 0px -15px;
} }
{% endif %} {% endif %}
{% else %} {% else %}
#page-wrapper { padding-top:20px; padding-bottom:30px; } #topchat { padding-top:20px; padding-bottom:30px; }
{% endif %} {% endif %}
.message { .message {
@ -57,7 +61,7 @@
{% block pagewrapper %} {% block pagewrapper %}
{% if app.user and ingroup %} {% if app.user and ingroup %}
{{ form_start(form) }} {{ form_start(form) }}
<div class='row'> <div id="topchat" class='row'>
{{ form_widget(form.message) }} {{ form_widget(form.message) }}
<input id="sendbymail" type="checkbox" id="item_essential" name="item[essential]" style="float:right" class='switch' ></input> <input id="sendbymail" type="checkbox" id="item_essential" name="item[essential]" style="float:right" class='switch' ></input>
<label class="custom-control-label" for="sendbymail">Envoyer par Mail ?</label> <label class="custom-control-label" for="sendbymail">Envoyer par Mail ?</label>