Verified Commit e073e0b5 authored by Damien's avatar Damien

FEAT #13664 TIME 1:25 Get Alfresco accounts

parent 9532a2a6
......@@ -561,6 +561,7 @@ $app->get('/externalSummary/{resId}', \ExternalSummary\controllers\SummaryContro
$app->get('/externalConnectionsEnabled', \SrcCore\controllers\CoreController::class . ':externalConnectionsEnabled');
//Alfresco
$app->get('/alfresco/accounts', \Alfresco\controllers\AlfrescoController::class . ':getAccounts');
$app->get('/alfresco/rootFolders', \Alfresco\controllers\AlfrescoController::class . ':getRootFolders');
$app->get('/alfresco/folders/{id}/children', \Alfresco\controllers\AlfrescoController::class . ':getChildrenFoldersById');
$app->get('/alfresco/autocomplete/folders', \Alfresco\controllers\AlfrescoController::class . ':getFolders');
......
......@@ -17,6 +17,8 @@ namespace Alfresco\controllers;
use Attachment\models\AttachmentModel;
use Convert\controllers\ConvertPdfController;
use Docserver\models\DocserverModel;
use Entity\models\EntityModel;
use Group\controllers\PrivilegeController;
use Resource\models\ResModel;
use Respect\Validation\Validator;
use Slim\Http\Request;
......@@ -29,6 +31,30 @@ use User\models\UserModel;
class AlfrescoController
{
public function getAccounts(Request $request, Response $response)
{
// if (!PrivilegeController::hasPrivilege(['privilegeId' => 'admin_alfresco', 'userId' => $GLOBALS['id']])) {
// return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
// }
$entities = EntityModel::get(['select' => ['external_id'], 'where' => ["external_id->>'alfresco' is not null"]]);
$accounts = [];
$alreadyAdded = [];
foreach ($entities as $entity) {
$alfresco = json_decode($entity['external_id'], true);
if (!in_array($alfresco['alfresco']['login'], $alreadyAdded)) {
$accounts[] = [
'label' => $alfresco['alfresco']['label'],
'login' => $alfresco['alfresco']['login']
];
$alreadyAdded[] = $alfresco['alfresco']['login'];
}
}
return $response->withJson(['accounts' => $accounts]);
}
public function getRootFolders(Request $request, Response $response)
{
$loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'apps/maarch_entreprise/xml/alfrescoConfig.xml']);
......
......@@ -80,6 +80,7 @@ return array(
'Clue\\StreamFilter\\' => array($vendorDir . '/clue/stream-filter/src'),
'Basket\\' => array($baseDir . '/src/app/basket'),
'Attachment\\' => array($baseDir . '/src/app/attachment'),
'Alfresco\\' => array($baseDir . '/src/app/external/alfresco'),
'Administration\\' => array($baseDir . '/src/app/administration'),
'Action\\' => array($baseDir . '/src/app/action'),
'AcknowledgementReceipt\\' => array($baseDir . '/src/app/acknowledgementReceipt'),
......
......@@ -160,6 +160,7 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd
'A' =>
array (
'Attachment\\' => 11,
'Alfresco\\' => 9,
'Administration\\' => 15,
'Action\\' => 7,
'AcknowledgementReceipt\\' => 23,
......@@ -465,6 +466,10 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd
array (
0 => __DIR__ . '/../..' . '/src/app/attachment',
),
'Alfresco\\' =>
array (
0 => __DIR__ . '/../..' . '/src/app/external/alfresco',
),
'Administration\\' =>
array (
0 => __DIR__ . '/../..' . '/src/app/administration',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment