13 namespace Fossology\UI\Api\Controllers;
37 use Psr\Container\ContainerInterface;
38 use Psr\Http\Message\ServerRequestInterface as Request;
39 use Slim\Psr7\Factory\StreamFactory;
88 $this->licenseDao = $this->container->get(
'dao.license');
89 $this->adminLicenseAckDao = $this->container->get(
'dao.license.acknowledgement');
90 $this->licenseStdCommentDao = $this->container->get(
'dao.license.stdc');
104 $shortName = $args[
"shortname"];
106 if (empty($shortName)) {
110 $license = $this->licenseDao->getLicenseByShortName($shortName,
111 $this->restHelper->getGroupId());
113 if ($license ===
null) {
115 "No license found with short name '$shortName'.");
118 $obligations = $this->licenseDao->getLicenseObligations([$license->getId()],
120 $obligations = array_merge($obligations,
121 $this->licenseDao->getLicenseObligations([$license->getId()],
true));
122 $obligationList = [];
123 foreach ($obligations as $obligation) {
125 $obligation[
'ob_pk'],
126 $obligation[
'ob_topic'],
127 $obligation[
'ob_type'],
128 $obligation[
'ob_text'],
129 $obligation[
'ob_classification'],
130 $obligation[
'ob_comment']
136 $license->getShortName(),
137 $license->getFullName(),
144 return $response->withJson($returnVal->getArray(), 200);
159 $query = $request->getQueryParams();
160 if ($apiVersion == ApiVersion::V2) {
165 $page = $request->getHeaderLine(self::PAGE_PARAM);
166 $limit = $request->getHeaderLine(self::LIMIT_PARAM);
167 $onlyActive = $request->getHeaderLine(self::ACTIVE_PARAM);
169 if (! empty($limit)) {
170 $limit = filter_var($limit, FILTER_VALIDATE_INT);
173 "limit should be positive integer > 1");
180 if (array_key_exists(
"kind", $query) && !empty($query[
"kind"]) &&
181 in_array($query[
"kind"], [
"all",
"candidate",
"main"])) {
182 $kind = $query[
"kind"];
185 $totalPages = $this->dbHelper->getLicenseCount($kind,
186 $this->restHelper->getGroupId());
187 $totalPages = intval(ceil($totalPages / $limit));
189 if (! empty($page) || $page ==
"0") {
190 $page = filter_var($page, FILTER_VALIDATE_INT);
193 "page should be positive integer > 0");
195 if ($totalPages != 0 && $page > $totalPages) {
197 "Can not exceed total pages: $totalPages"))
198 ->setHeaders([
"X-Total-Pages" => $totalPages]);
203 if (! empty($onlyActive)) {
204 $onlyActive = filter_var($onlyActive, FILTER_VALIDATE_BOOLEAN);
209 $licenses = $this->dbHelper->getLicensesPaginated($page, $limit,
210 $kind, $this->restHelper->getGroupId(), $onlyActive);
213 foreach ($licenses as $license) {
216 $license[
'rf_shortname'],
217 $license[
'rf_fullname'],
222 $license[
'group_fk'] != 0
224 $licenseList[] = $newRow->getArray();
227 return $response->withHeader(
"X-Total-Pages", $totalPages)
228 ->withJson($licenseList, 200);
244 if ($newLicense === -1) {
246 "Input contains additional properties.");
248 if ($newLicense === -2) {
253 "non-candidate license.");
255 $tableName =
"license_ref";
257 "rf_shortname" => $newLicense->getShortName(),
258 "rf_fullname" => $newLicense->getFullName(),
259 "rf_text" => $newLicense->getText(),
260 "rf_md5" => md5($newLicense->getText()),
261 "rf_risk" => $newLicense->getRisk(),
262 "rf_url" => $newLicense->getUrl(),
263 "rf_detector_type" => 1
266 if ($newLicense->getIsCandidate()) {
267 $tableName =
"license_candidate";
268 $assocData[
"group_fk"] = $this->restHelper->getGroupId();
269 $assocData[
"rf_user_fk_created"] = $this->restHelper->getUserId();
270 $assocData[
"rf_user_fk_modified"] = $this->restHelper->getUserId();
271 $assocData[
"marydone"] = $newLicense->getMergeRequest();
272 $okToAdd = $this->
isNewLicense($newLicense->getShortName(),
273 $this->restHelper->getGroupId());
275 $okToAdd = $this->
isNewLicense($newLicense->getShortName());
279 $newLicense->getShortName() .
"' already exists!");
282 $rfPk = $this->dbHelper->getDbManager()->insertTableRow($tableName,
283 $assocData, __METHOD__ .
".newLicense",
"rf_pk");
284 $newInfo =
new Info(201, $rfPk, InfoType::INFO);
287 "License with same text already exists!", $e);
289 return $response->withJson($newInfo->getArray(), $newInfo->getCode());
304 $shortName = $args[
"shortname"];
305 if (empty($shortName)) {
309 $license = $this->licenseDao->getLicenseByShortName($shortName,
310 $this->restHelper->getGroupId());
312 if ($license ===
null) {
314 "No license found with short name '$shortName'.");
316 $isCandidate = $this->restHelper->getDbHelper()->doesIdExist(
317 "license_candidate",
"rf_pk", $license->getId());
320 "Need to be admin to edit non-candidate license.");
322 if ($isCandidate && ! $this->restHelper->getUserDao()->isAdvisorOrAdmin(
323 $this->restHelper->getUserId(), $this->restHelper->getGroupId())) {
325 "Operation not permitted for this group.");
329 if (array_key_exists(
'fullName', $newParams)) {
332 if (array_key_exists(
'text', $newParams)) {
335 if (array_key_exists(
'url', $newParams)) {
338 if (array_key_exists(
'risk', $newParams)) {
339 $assocData[
'rf_risk'] = intval($newParams[
'risk']);
341 if (empty($assocData)) {
345 $tableName =
"license_ref";
347 $tableName =
"license_candidate";
349 $this->dbHelper->getDbManager()->updateTableRow($tableName, $assocData,
350 "rf_pk", $license->getId(), __METHOD__ .
".updateLicense");
351 $newInfo =
new Info(200,
"License " . $license->getShortName() .
352 " updated.", InfoType::INFO);
353 return $response->withJson($newInfo->getArray(), $newInfo->getCode());
364 $tableName =
"ONLY license_ref";
366 $params = [$shortName];
367 $statement = __METHOD__;
369 $tableName =
"license_candidate";
370 $where =
"AND group_fk = $2";
371 $params[] = $groupId;
372 $statement .=
".candidate";
374 $sql =
"SELECT count(*) cnt FROM " .
375 "$tableName WHERE rf_shortname = $1 $where;";
376 $result = $this->dbHelper->getDbManager()->getSingleRow($sql, $params,
378 return $result[
"cnt"] == 0;
390 public function handleImportLicense($request, $response, $args)
394 $symReq = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
396 $adminLicenseFromCsv = $this->restHelper->getPlugin(
'admin_license_from_csv');
398 $uploadedFile = $symReq->files->get($adminLicenseFromCsv->getFileInputName($apiVersion),
404 if (array_key_exists(
"delimiter", $requestBody) && !empty($requestBody[
"delimiter"])) {
405 $delimiter = $requestBody[
"delimiter"];
407 if (array_key_exists(
"enclosure", $requestBody) && !empty($requestBody[
"enclosure"])) {
408 $enclosure = $requestBody[
"enclosure"];
411 $res = $adminLicenseFromCsv->handleFileUpload($uploadedFile, $delimiter,
415 throw new HttpBadRequestException($res[1]);
418 $newInfo =
new Info($res[2], $res[1], InfoType::INFO);
419 return $response->withJson($newInfo->getArray(), $newInfo->getCode());
431 public function getCandidates($request, $response, $args)
436 $adminLicenseCandidate = $this->restHelper->getPlugin(
"admin_license_candidate");
438 return $response->withJson($licenses, 200);
450 public function deleteAdminLicenseCandidate($request, $response, $args)
453 $id = intval($args[
'id']);
455 $adminLicenseCandidate = $this->restHelper->getPlugin(
'admin_license_candidate');
457 if (!$adminLicenseCandidate->getDataRow($id)) {
458 throw new HttpNotFoundException(
"License candidate not found.");
460 $res = $adminLicenseCandidate->doDeleteCandidate($id,
false);
461 $message = $res->getContent();
462 if ($res->getContent() !==
'true') {
463 throw new HttpConflictException(
464 "License used at following locations, can not delete: " .
467 $resInfo =
new Info(202,
"License candidate will be deleted.",
469 return $response->withJson($resInfo->getArray(), $resInfo->getCode());
485 $rawData = $this->adminLicenseAckDao->getAllAcknowledgements();
487 $acknowledgements = [];
488 foreach ($rawData as $ack) {
489 $acknowledgements[] =
new AdminAcknowledgement(intval($ack[
'la_pk']), $ack[
'name'], $ack[
'acknowledgement'], $ack[
'is_enabled'] ==
"t");
492 $res = array_map(fn($acknowledgement) => $acknowledgement->getArray($apiVersion), $acknowledgements);
493 return $response->withJson($res, 200);
514 if (!is_array($body)) {
517 foreach (array_keys($body) as $index) {
518 $ackReq = $body[$index];
519 if ((!$ackReq[
'update'] && empty($ackReq[
'name'])) || ($ackReq[
'update'] && empty($ackReq[
'name']) && !$ackReq[
'toggle'])) {
520 $error =
new Info(400,
"Acknowledgement name missing from the request #" . ($index + 1), InfoType::ERROR);
521 $errors[] = $error->getArray();
523 }
else if ((!$ackReq[
'update'] && empty($ackReq[
'ack'])) || ($ackReq[
'update'] && empty($ackReq[
'ack']) && !$ackReq[
'toggle'])) {
524 $error =
new Info(400,
"Acknowledgement text missing from the request #" . ($index + 1), InfoType::ERROR);
525 $errors[] = $error->getArray();
529 if ($ackReq[
'update']) {
531 if (empty($ackReq[
'id'])) {
532 $error =
new Info(400,
"Acknowledgement ID missing from the request #" . ($index + 1), InfoType::ERROR);
533 $errors[] = $error->getArray();
537 $sql =
"SELECT la_pk, name FROM license_std_acknowledgement WHERE la_pk = $1;";
538 $existingAck = $this->dbHelper->getDbManager()->getSingleRow($sql, [$ackReq[
'id']]);
540 if (empty($existingAck)) {
541 $error =
new Info(404,
"Acknowledgement not found for the request #" . ($index + 1), InfoType::ERROR);
542 $errors[] = $error->getArray();
544 }
else if ($existingAck[
"name"] != $ackReq[
"name"] && $this->dbHelper->doesIdExist(
"license_std_acknowledgement",
"name", $ackReq[
"name"])) {
545 $error =
new Info(400,
"Name already exists.", InfoType::ERROR);
546 $errors[] = $error->getArray();
550 if ($ackReq[
"name"] && $ackReq[
"ack"]) {
551 $this->adminLicenseAckDao->updateAcknowledgement($ackReq[
"id"], $ackReq[
"name"], $ackReq[
"ack"]);
554 if ($ackReq[
"toggle"]) {
555 $this->adminLicenseAckDao->toggleAcknowledgement($ackReq[
"id"]);
558 $info =
new Info(200,
"Successfully updated admin license acknowledgement with name '" . $existingAck[
"name"] .
"'", InfoType::INFO);
561 if ($this->dbHelper->doesIdExist(
"license_std_acknowledgement",
"name", $ackReq[
"name"])) {
562 $error =
new Info(400,
"Name already exists for the request #" . ($index + 1), InfoType::ERROR);
563 $errors[] = $error->getArray();
566 $res = $this->adminLicenseAckDao->insertAcknowledgement($ackReq[
"name"], $ackReq[
"ack"]);
568 $error =
new Info(500,
"Error while inserting new acknowledgement.", InfoType::ERROR);
569 $errors[] = $error->getArray();
572 $info =
new Info(201,
"Acknowledgement added successfully.", InfoType::INFO);
574 $success[] = $info->getArray();
576 return $response->withJson([
577 'success' => $success,
593 $rawData = $this->licenseStdCommentDao->getAllComments();
595 foreach ($rawData as $cmt) {
596 $comments[] =
new LicenseStandardComment(intval($cmt[
'lsc_pk']), $cmt[
'name'], $cmt[
'comment'], $cmt[
'is_enabled'] ==
"t");
598 $res = array_map(fn($comment) => $comment->getArray($apiVersion), $comments);
599 return $response->withJson($res, 200);
622 if (!is_array($body)) {
625 foreach (array_keys($body) as $index) {
626 $commentReq = $body[$index];
629 if ((!$commentReq[
'update'] && empty($commentReq[
'name']))) {
630 $error =
new Info(400,
"Comment name missing from the request #" . ($index + 1), InfoType::ERROR);
631 $errors[] = $error->getArray();
633 }
else if ((!$commentReq[
'update'] && empty($commentReq[
'comment']))) {
634 $error =
new Info(400,
"Comment text missing from the request #" . ($index + 1), InfoType::ERROR);
635 $errors[] = $error->getArray();
637 }
else if ($commentReq[
'update'] && empty($commentReq[
'name']) && empty($commentReq[
'comment']) && empty($commentReq[
'toggle'])) {
638 $error =
new Info(400,
"Comment name, text or toggle missing from the request #" . ($index + 1), InfoType::ERROR);
639 $errors[] = $error->getArray();
643 if ($commentReq[
'update']) {
645 if (empty($commentReq[
'id'])) {
646 $error =
new Info(400,
"Standard Comment ID missing from the request #" . ($index + 1), InfoType::ERROR);
647 $errors[] = $error->getArray();
651 $sql =
"SELECT lsc_pk, name, comment FROM license_std_comment WHERE lsc_pk = $1;";
652 $existingComment = $this->dbHelper->getDbManager()->getSingleRow($sql, [$commentReq[
'id']]);
654 if (empty($existingComment)) {
655 $error =
new Info(404,
"Standard comment not found for the request #" . ($index + 1), InfoType::ERROR);
656 $errors[] = $error->getArray();
659 }
else if ($existingComment[
"name"] != $commentReq[
"name"] && $this->dbHelper->doesIdExist(
"license_std_comment",
"name", $commentReq[
"name"])) {
660 $error =
new Info(400,
"Name already exists.", InfoType::ERROR);
661 $errors[] = $error->getArray();
666 if ($commentReq[
"name"] && $commentReq[
"comment"]) {
667 $this->licenseStdCommentDao->updateComment($commentReq[
"id"], $commentReq[
"name"], $commentReq[
"comment"]);
668 }
else if ($commentReq[
"name"]) {
669 $this->licenseStdCommentDao->updateComment($commentReq[
"id"], $commentReq[
"name"], $existingComment[
"comment"]);
670 }
else if ($commentReq[
"comment"]) {
671 $this->licenseStdCommentDao->updateComment($commentReq[
"id"], $existingComment[
"name"], $commentReq[
"comment"]);
674 if ($commentReq[
"toggle"]) {
675 $this->licenseStdCommentDao->toggleComment($commentReq[
"id"]);
678 $info =
new Info(200,
"Successfully updated standard comment", InfoType::INFO);
681 if ($this->dbHelper->doesIdExist(
"license_std_comment",
"name", $commentReq[
"name"])) {
682 $error =
new Info(400,
"Name already exists for the request #" . ($index + 1), InfoType::ERROR);
683 $errors[] = $error->getArray();
686 $res = $this->licenseStdCommentDao->insertComment($commentReq[
"name"], $commentReq[
"comment"]);
688 $error =
new Info(500,
"Error while inserting new comment.", InfoType::ERROR);
689 $errors[] = $error->getArray();
692 $info =
new Info(201,
"Comment with name '". $commentReq[
'name'] .
"' added successfully.", InfoType::INFO);
694 $success[] = $info->getArray();
696 return $response->withJson([
697 'success' => $success,
711 public function verifyLicense($request, $response, $args)
714 $licenseShortName = $args[
"shortname"];
716 $parentName = $body[
"parentShortname"];
718 if (empty($licenseShortName) || empty($parentName)) {
720 "License ShortName or Parent ShortName is missing.");
723 $license = $this->licenseDao->getLicenseByShortName($licenseShortName, $this->restHelper->getGroupId());
724 if ($licenseShortName != $parentName) {
725 $parentLicense = $this->licenseDao->getLicenseByShortName($parentName, $this->restHelper->getGroupId());
727 $parentLicense = $license;
730 if (empty($license) || empty($parentLicense)) {
731 throw new HttpNotFoundException(
"License not found.");
736 $adminLicenseCandidate = $this->restHelper->getPlugin(
'admin_license_candidate');
737 $ok = $adminLicenseCandidate->verifyCandidate($license->getId(), $licenseShortName, $parentLicense->getId());
738 }
catch (\Throwable $th) {
739 throw new HttpConflictException(
'The license text already exists.', $th);
743 throw new HttpBadRequestException(
'Short name must be unique');
745 $with = $parentLicense->getId() === $license->getId() ?
'' :
" as variant of ($parentName).";
746 $info =
new Info(200,
'Successfully verified candidate ('.$licenseShortName.
')'.$with, InfoType::INFO);
747 return $response->withJson($info->getArray(), $info->getCode());
759 public function mergeLicense($request, $response, $args)
762 $licenseShortName = $args[
"shortname"];
764 $parentName = $body[
"parentShortname"];
766 if (empty($licenseShortName) || empty($parentName)) {
767 throw new HttpBadRequestException(
768 "License ShortName or Parent ShortName is missing.");
770 if ($licenseShortName == $parentName) {
771 throw new HttpBadRequestException(
772 "License ShortName and Parent ShortName are same.");
775 $license = $this->licenseDao->getLicenseByShortName($licenseShortName, $this->restHelper->getGroupId());
776 $mergeLicense = $this->licenseDao->getLicenseByShortName($parentName, $this->restHelper->getGroupId());
778 if (empty($license) || empty($mergeLicense)) {
779 throw new HttpNotFoundException(
"License not found.");
783 $adminLicenseCandidate = $this->restHelper->getPlugin(
'admin_license_candidate');
784 $vars = $adminLicenseCandidate->getDataRow($license->getId());
786 throw new HttpNotFoundException(
"Candidate license not found.");
790 $vars[
'shortname'] = $vars[
'rf_shortname'];
791 $ok = $adminLicenseCandidate->mergeCandidate($license->getId(), $mergeLicense->getId(), $vars);
792 }
catch (\Throwable $th) {
793 throw new HttpConflictException(
'The license text already exists.', $th);
797 throw new HttpInternalServerErrorException(
"Please try again later.");
799 $info =
new Info(200,
"Successfully merged candidate ($parentName) into ($licenseShortName).", InfoType::INFO);
800 return $response->withJson($info->getArray(), $info->getCode());
812 public function getSuggestedLicense($request, $response, $args)
816 $rfText = $body[
"referenceText"];
817 if (empty($rfText)) {
818 throw new HttpBadRequestException(
"Reference text is missing.");
821 $adminLicenseCandidate = $this->restHelper->getPlugin(
'admin_license_candidate');
822 list ($suggestIds, $rendered) = $adminLicenseCandidate->suggestLicenseId($rfText,
true);
825 foreach ($rendered as $value) {
826 $highlights[] = $value->getArray();
829 if (! empty($suggestIds)) {
830 $suggest = $suggestIds[0];
831 $suggestLicense = $adminLicenseCandidate->getDataRow($suggest,
'ONLY license_ref');
833 'id' => intval($suggestLicense[
'rf_pk']),
834 'spdxName' => $suggestLicense[
'rf_spdx_id'],
835 'shortName' => $suggestLicense[
'rf_shortname'],
836 'fullName' => $suggestLicense[
'rf_fullname'],
837 'text' => $suggestLicense[
'rf_text'],
838 'url' => $suggestLicense[
'rf_url'],
839 'notes' => $suggestLicense[
'rf_notes'],
840 'risk' => intval($suggestLicense[
'rf_risk']),
841 'highlights' => $highlights,
844 if (empty($suggestLicense)) {
845 $suggestLicense = [];
847 return $response->withJson($suggestLicense, 200);
862 $query = $request->getQueryParams();
864 if (array_key_exists(
'id', $query)) {
865 $rf = intval($query[
'id']);
868 (! $this->dbHelper->doesIdExist(
"license_ref",
"rf_pk", $rf) &&
869 ! $this->dbHelper->doesIdExist(
"license_candidate",
"rf_pk", $rf))) {
872 $dbManager = $this->dbHelper->getDbManager();
874 $content = $licenseCsvExport->createCsv($rf);
875 $fileName =
"fossology-license-export-" . date(
"YMj-Gis");
876 $newResponse = $response->withHeader(
'Content-type',
'text/csv, charset=UTF-8')
877 ->withHeader(
'Content-Disposition',
'attachment; filename=' . $fileName .
'.csv')
878 ->withHeader(
'Pragma',
'no-cache')
879 ->withHeader(
'Cache-Control',
'no-cache, must-revalidate, maxage=1, post-check=0, pre-check=0')
880 ->withHeader(
'Expires',
'Expires: Thu, 19 Nov 1981 08:52:00 GMT');
881 $sf =
new StreamFactory();
882 return $newResponse->withBody(
883 $content ? $sf->createStream($content) : $sf->createStream(
'')
899 $query = $request->getQueryParams();
901 if (array_key_exists(
'id', $query)) {
902 $rf = intval($query[
'id']);
905 (! $this->dbHelper->doesIdExist(
"license_ref",
"rf_pk", $rf) &&
906 ! $this->dbHelper->doesIdExist(
"license_candidate",
"rf_pk", $rf))) {
909 $dbManager = $this->dbHelper->getDbManager();
911 $content = $licenseCsvExport->createCsv($rf,
false,
true);
912 $fileName =
"fossology-license-export-" . date(
"YMj-Gis");
913 $newResponse = $response->withHeader(
'Content-type',
'text/json, charset=UTF-8')
914 ->withHeader(
'Content-Disposition',
'attachment; filename=' . $fileName .
'.json')
915 ->withHeader(
'Pragma',
'no-cache')
916 ->withHeader(
'Cache-Control',
'no-cache, must-revalidate, maxage=1, post-check=0, pre-check=0')
917 ->withHeader(
'Expires',
'Expires: Thu, 19 Nov 1981 08:52:00 GMT');
918 $sf =
new StreamFactory();
919 return $newResponse->withBody(
920 $content ? $sf->createStream($content) : $sf->createStream(
'')
944 $query = $request->getQueryParams();
947 if (array_key_exists(
'format', $query) && !empty($query[
'format'])) {
948 $format = strtolower($query[
'format']);
950 if (!in_array($format, array(
'csv',
'json'))) {
955 if (array_key_exists(
'filter', $query) && !empty($query[
'filter'])) {
956 $filter = strtolower($query[
'filter']);
958 if (!in_array($filter, array(
'all',
'user',
'group'))) {
964 if ($filter ===
'user') {
965 if (!array_key_exists(
'userId', $query)) {
968 $userPk = intval($query[
'userId']);
972 } elseif ($filter ===
'group') {
973 if (!array_key_exists(
'groupId', $query)) {
976 $groupPk = intval($query[
'groupId']);
982 $dbManager = $this->dbHelper->getDbManager();
985 $isJson = ($format ===
'json');
988 if (array_key_exists(
'delimiter', $query) && !empty($query[
'delimiter'])) {
989 $delimiter = $query[
'delimiter'];
993 if (array_key_exists(
'enclosure', $query) && !empty($query[
'enclosure'])) {
994 $enclosure = $query[
'enclosure'];
998 $bulkTextExport->setDelimiter($delimiter);
999 $bulkTextExport->setEnclosure($enclosure);
1000 }
catch (\InvalidArgumentException $e) {
1005 $content = $bulkTextExport->exportBulkText($userPk, $groupPk, $isJson);
1006 $fileName =
"fossology-bulk-text-export-" . date(
"YMj-Gis");
1007 $extension = $isJson ?
'json' :
'csv';
1008 $contentType = $isJson ?
'application/json; charset=UTF-8' :
'text/csv; charset=UTF-8';
1010 $newResponse = $response->withHeader(
'Content-type', $contentType)
1011 ->withHeader(
'Content-Disposition',
'attachment; filename=' . $fileName .
'.' . $extension)
1012 ->withHeader(
'Pragma',
'no-cache')
1013 ->withHeader(
'Cache-Control',
'no-cache, must-revalidate, maxage=1, post-check=0, pre-check=0')
1014 ->withHeader(
'Expires',
'Expires: Thu, 19 Nov 1981 08:52:00 GMT');
1016 $sf =
new StreamFactory();
1017 return $newResponse->withBody(
1018 $content ? $sf->createStream($content) : $sf->createStream(
'')
Helper class to export license reference bulk data as CSV or JSON from the DB.
Helper class to export license list as a CSV from the DB.
Contains the constants and helpers for authentication of user.
static isAdmin()
Check if user is admin.
static replaceUnicodeControlChar($input, $replace="")
handleLicenseStandardComment($request, $response, $args)
exportBulkText($request, $response, $args)
handleAdminLicenseAcknowledgement($request, $response, $args)
isNewLicense($shortName, $groupId=0)
exportAdminLicenseToJSON($request, $response, $args)
createLicense($request, $response, $args)
updateLicense($request, $response, $args)
exportAdminLicenseToCSV($request, $response, $args)
getAllLicenseStandardComments($request, $response, $args)
const LICENSE_FETCH_LIMIT
getAllAdminAcknowledgements($request, $response, $args)
getAllLicenses($request, $response, $args)
getLicense($request, $response, $args)
Base controller for REST calls.
getParsedBody(ServerRequestInterface $request)
Parse request body as JSON and return associative PHP array.
Override Slim response for withJson function.
static getVersion(ServerRequestInterface $request)
Different type of infos provided by REST.
Info model to contain general error and return values.
static convertDbArray($rows, $version=ApiVersion::V1)
static parseFromArray($inputLicense)