Skip to content
Snippets Groups Projects
Commit 0a076ebb authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

FIX #12026 TIME 0:10 fix perimeter check

parent f86d7ec7
No related branches found
No related tags found
No related merge requests found
......@@ -489,11 +489,15 @@ class AttachmentController
return $response->withStatus(403)->withJson(['errors' => 'id param is not an integer']);
}
$document = AttachmentModel::getById(['select' => [1], 'id' => $args['id']]);
$document = AttachmentModel::getById(['select' => ['res_id_master'], 'id' => $args['id']]);
if (empty($document)) {
return $response->withStatus(400)->withJson(['errors' => 'Document does not exist']);
}
if (!ResController::hasRightByResId(['resId' => [$document['res_id_master']], 'userId' => $GLOBALS['id']])) {
return $response->withStatus(403)->withJson(['errors' => 'Document out of perimeter']);
}
$docserver = DocserverModel::getByDocserverId(['docserverId' => 'TNL_ATTACH', 'select' => ['path_template']]);
if (empty($docserver['path_template']) || !file_exists($docserver['path_template'])) {
return $response->withStatus(400)->withJson(['errors' => 'Docserver does not exist']);
......
......@@ -757,6 +757,10 @@ class ResController extends ResourceControlController
return $response->withStatus(400)->withJson(['errors' => 'Document does not exist']);
}
if (!ResController::hasRightByResId(['resId' => [$args['resId']], 'userId' => $GLOBALS['id']])) {
return $response->withStatus(403)->withJson(['errors' => 'Document out of perimeter']);
}
$docserver = DocserverModel::getByDocserverId(['docserverId' => 'TNL_MLB', 'select' => ['path_template']]);
if (empty($docserver['path_template']) || !file_exists($docserver['path_template'])) {
return $response->withStatus(400)->withJson(['errors' => 'Docserver does not exist']);
......
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