FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Fossology\UI\Api\Controllers\RestController Class Reference

Base controller for REST calls. More...

Inheritance diagram for Fossology\UI\Api\Controllers\RestController:
Inheritance graph
Collaboration diagram for Fossology\UI\Api\Controllers\RestController:
Collaboration graph

Public Member Functions

 __construct ($container)
 

Protected Member Functions

 getParsedBody (ServerRequestInterface $request)
 Parse request body as JSON and return associative PHP array. More...
 
 throwNotAdminException ()
 
 uploadAccessible ($id)
 
 isItemExists (int $uploadId, int $itemId)
 

Protected Attributes

 $container
 
 $restHelper
 
 $dbHelper
 

Detailed Description

Base controller for REST calls.

Definition at line 29 of file RestController.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ getParsedBody()

Fossology\UI\Api\Controllers\RestController::getParsedBody ( ServerRequestInterface  $request)
protected

Parse request body as JSON and return associative PHP array.

If request is of type application/json, read the body content and parse with json_decode(). Otherwise, use slim's getParsedBody().

Parameters
ServerRequestInterface$requestRequest to parse
Returns
array|null Parsed JSON, or null on error

Definition at line 69 of file RestController.php.

◆ isItemExists()

Fossology\UI\Api\Controllers\RestController::isItemExists ( int  $uploadId,
int  $itemId 
)
protected

Check if upload tree is accessible

Parameters
int$uploadId
int$itemId
Returns
void
Exceptions
HttpNotFoundException

Definition at line 119 of file RestController.php.

◆ throwNotAdminException()

Fossology\UI\Api\Controllers\RestController::throwNotAdminException ( )
protected

Throw an HttpForbiddenException if the user is not admin.

Exceptions
HttpForbiddenException

Definition at line 86 of file RestController.php.

◆ uploadAccessible()

Fossology\UI\Api\Controllers\RestController::uploadAccessible (   $id)
protected

Check if upload is accessible

Parameters
integer$idUpload ID
Exceptions
HttpNotFoundExceptionUpload not found
HttpForbiddenExceptionUpload not accessible

Definition at line 100 of file RestController.php.

Member Data Documentation

◆ $container

ContainerInterface Fossology\UI\Api\Controllers\RestController::$container
protected

Slim container

Definition at line 35 of file RestController.php.

◆ $dbHelper

DbHelper Fossology\UI\Api\Controllers\RestController::$dbHelper
protected

DB helper object in use

Definition at line 47 of file RestController.php.

◆ $restHelper

RestHelper Fossology\UI\Api\Controllers\RestController::$restHelper
protected

Rest helper object in use

Definition at line 41 of file RestController.php.


The documentation for this class was generated from the following file: