Skip to content
Snippets Groups Projects
Verified Commit e3180a6c authored by Florian Azizian's avatar Florian Azizian
Browse files

FEAT #13676 TIME 0:10 unit test

parent c10e788b
No related branches found
No related tags found
No related merge requests found
......@@ -188,7 +188,6 @@ $app->delete('/docservers/{id}', \Docserver\controllers\DocserverController::cla
//DocserverTypes
$app->get('/docserverTypes', \Docserver\controllers\DocserverTypeController::class . ':get');
$app->get('/docserverTypes/{id}', \Docserver\controllers\DocserverTypeController::class . ':getById');
//doctypes
$app->get('/doctypes', \Doctype\controllers\FirstLevelController::class . ':getTree');
......
......@@ -19,18 +19,6 @@ use SrcCore\models\ValidatorModel;
class ConfigurationModel
{
public static function get(array $aArgs = [])
{
ValidatorModel::arrayType($aArgs, ['select']);
$configurations = DatabaseModel::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['configurations']
]);
return $configurations;
}
public static function getByService(array $aArgs)
{
ValidatorModel::notEmpty($aArgs, ['service']);
......
......@@ -471,29 +471,4 @@ class DocserverController
return true;
}
private static function directoryWasher(array $aArgs)
{
ValidatorModel::notEmpty($aArgs, ['path']);
ValidatorModel::stringType($aArgs, ['path']);
if (!is_dir($aArgs['path'])) {
return ['errors' => '[directoryWasher] Path does not exist'];
}
$aFiles = scandir($aArgs['path']);
foreach ($aFiles as $file) {
if ($file != '.' && $file != '..') {
if (filetype($aArgs['path'] . '/' . $file) == 'dir') {
DocserverController::directoryWasher(['path' => $aArgs['path'] . '/' . $file]);
} else {
unlink($aArgs['path'] . '/' . $file);
}
}
}
reset($aFiles);
return true;
}
}
......@@ -29,19 +29,4 @@ class DocserverTypeController
return $response->withJson(['docserverTypes' => DocserverTypeModel::get(['orderBy' => ['docserver_type_label']])]);
}
public function getById(Request $request, Response $response, array $aArgs)
{
if (!PrivilegeController::hasPrivilege(['privilegeId' => 'admin_docservers', 'userId' => $GLOBALS['id']])) {
return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
}
$docserverType = DocserverTypeModel::getById(['id' => $aArgs['id']]);
if(empty($docserverType)){
return $response->withStatus(400)->withJson(['errors' => 'Docserver Type not found']);
}
return $response->withJson($docserverType);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment