15 namespace Fossology\UI\Api\Controllers;
22 use Psr\Container\ContainerInterface;
23 use Psr\Http\Message\ServerRequestInterface;
56 $this->restHelper = $this->container->get(
'helper.restHelper');
57 $this->dbHelper = $this->restHelper->getDbHelper();
72 $content = $request->getBody()->getContents();
73 return json_decode($content,
true);
76 return $request->getParsedBody();
101 if (! $this->dbHelper->doesIdExist(
"upload",
"upload_pk", $id)) {
104 if (! $this->restHelper->getUploadDao()->isAccessible($id,
105 $this->restHelper->getGroupId())) {
120 if (!$this->dbHelper->doesIdExist(
121 $this->restHelper->getUploadDao()->getUploadtreeTableName($uploadId),
122 "uploadtree_pk", $itemId)) {
134 return strcasecmp($request->getHeaderLine(
'Content-Type'),
135 "application/json") === 0;
Contains the constants and helpers for authentication of user.
static isAdmin()
Check if user is admin.
Base controller for REST calls.
isItemExists(int $uploadId, int $itemId)
getParsedBody(ServerRequestInterface $request)
Parse request body as JSON and return associative PHP array.
Provides helper methods to access database for REST api.
Provides various DAO helper functions for REST api.