composer & migration ninegate

This commit is contained in:
afornerot 2023-09-08 10:15:46 +02:00
parent d8db726fc4
commit 4de1c5457f
6 changed files with 32 additions and 9 deletions

View File

@ -74,6 +74,9 @@
"symfony/polyfill-php56": "*"
},
"scripts": {
"pre-install-cmd": [
"php scripts/checkcomposer.php"
],
"auto-scripts": {
"cache:clear": "symfony-cmd",
"cache:clear --env=prod": "symfony-cmd",

View File

@ -0,0 +1,13 @@
<?php
$requiredVersion = 'version 1'; // La version interdite
$composerVersion = trim(shell_exec('COMPOSER_ALLOW_SUPERUSER=1 composer --version --no-ansi'));
echo $composerVersion."\n";
if (stripos($composerVersion,$requiredVersion)===false ) {
echo "La version de Composer $requiredVersion n'est pas autorisée" . PHP_EOL;
echo "Veuillez mettre à jour Composer avec 'composer self-update --1'." . PHP_EOL;
echo "Ou executez le scripts/reconfigure.sh" . PHP_EOL;
exit(1); // Quitte avec un code d'erreur
}

View File

@ -28,6 +28,8 @@ fi
# Installation des dépendances composer
echo COMPOSER = Install
export COMPOSER_ALLOW_SUPERUSER=1
composer self-update --1 --quiet
composer install --quiet
php bin/console app:AppInit --env=prod

View File

@ -427,7 +427,7 @@ class SynchroUsersCommand extends Command
$url=$appmasterurl;
// Entete
$headers = ['Accept' => 'application/json'];
$headers = ['Accept' => 'application/json', 'key' => $appmasterkey];
$query = [];
// Paramétrage unirest
@ -437,7 +437,7 @@ class SynchroUsersCommand extends Command
// Login sans proxy
try{
$response = \Unirest\Request::post($url.'/rest/login',$headers,["key"=>$appmasterkey]);
$response = \Unirest\Request::get($url.'/rest/login',$headers);
}
catch (\Exception $e) {
// On tente avec le proxy s'il y en a un
@ -448,7 +448,7 @@ class SynchroUsersCommand extends Command
\Unirest\Request::proxy($proxyHost, $proxyPort, CURLPROXY_HTTP, true);
try{
$response = \Unirest\Request::post($url.'/rest/login/'.$appmasterkey,$headers,$query);
$response = \Unirest\Request::get($url.'/rest/login',$headers);
}
catch (\Exception $e) {
die("Erreur de communication API = ".$e->getMessage()."\n");
@ -468,7 +468,7 @@ class SynchroUsersCommand extends Command
// Récupération des informations groups issus du masteridentity
try{
$response = \Unirest\Request::post($url.'/rest/groups',$headers,["key"=>$appmasterkey]);
$response = \Unirest\Request::get($url.'/rest/groups',$headers);
}
catch (\Exception $e) {
die("Erreur de communication API = ".$e->getMessage()."\n");
@ -502,7 +502,7 @@ class SynchroUsersCommand extends Command
// Récupération des informations utilisateurs issus du masteridentity
try{
$response = \Unirest\Request::post($url.'/rest/users',$headers,["key"=>$appmasterkey]);
$response = \Unirest\Request::get($url.'/rest/users',$headers);
}
catch (\Exception $e) {
die("Erreur de communication API = ".$e->getMessage()."\n");

View File

@ -210,7 +210,7 @@ class SecurityController extends AbstractController
$url=$appmasterurl;
// Entete
$headers = ['Accept' => 'application/json'];
$headers = ['Accept' => 'application/json', 'key' => $appmasterkey];
$query = [];
// Paramétrage unirest
@ -220,7 +220,7 @@ class SecurityController extends AbstractController
// Login sans proxy
try{
$response = \Unirest\Request::post($url.'/rest/login',$headers,["key"=>$appmasterkey]);
$response = \Unirest\Request::get($url.'/rest/login',$headers);
}
catch (\Exception $e) {
// On tente avec le proxy s'il y en a un
@ -231,7 +231,7 @@ class SecurityController extends AbstractController
\Unirest\Request::proxy($proxyHost, $proxyPort, CURLPROXY_HTTP, true);
try{
$response = \Unirest\Request::post($url.'/rest/login',$headers,["key"=>$appmasterkey]);
$response = \Unirest\Request::get($url.'/rest/login',$headers);
}
catch (\Exception $e) {
die("Erreur de communication API = ".$e->getMessage()."\n");
@ -247,7 +247,7 @@ class SecurityController extends AbstractController
// Récupération des informations du user
try{
$response = \Unirest\Request::post($url.'/rest/user/'.$user->getUsername(),$headers,["key"=>$appmasterkey,"only"=>"user,groups"]);
$response = \Unirest\Request::get($url.'/rest/user/'.$user->getUsername(),$headers,["only"=>"user,groups"]);
}
catch (\Exception $e) {
die("Erreur de communication API = ".$e->getMessage()."\n");

View File

@ -18,8 +18,13 @@ APP_MASTERURL=
APP_MASTERKEY=
%else
APP_MASTERURL=%%nineskeletor_urlidentity
%if %%getVar("nineskeletor_urlidentity", "/ninagate") == "/ninegate"
%set keyfile = %%getVar('container_path_web','') + '/var/www/html/ninegate/.key'
APP_MASTERKEY=%%pwdreader("",%%keyfile)
%else
APP_MASTERKEY=%%nineskeletor_apikeyidentity
%end if
%end if
# BDD