FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Fossology\UI\Api\Helper\UploadHelper Class Reference

Handle new file uploads from Slim framework and move to FOSSology. More...

Collaboration diagram for Fossology\UI\Api\Helper\UploadHelper:
Collaboration graph

Public Member Functions

 __construct ()
 
 handleScheduleAnalysis ($uploadId, $folderId, $scanOptionsJSON, $newUpload=false)
 
 createNewUpload ($reqBody, $folderId, $fileDescription, $isPublic, $ignoreScm, $uploadType, $applyGlobal=false)
 
 fetchClearingStatus ($itemTreeBounds, $clearingDao, $groupId)
 

Public Attributes

const VALID_VCS_TYPES
 
const VALID_UPLOAD_TYPES
 

Private Member Functions

 createFileUpload ($uploadedFile, $folderId, $fileDescription, $isPublic, $ignoreScm=0, $applyGlobal=0)
 
 handleUpload ($body, $uploadType, $folderId, $fileDescription, $isPublic, $ignoreScm=0, $applyGlobal=0)
 
 sanitizeVcsData (&$vcsData)
 Check if the passed VCS object is correct or not. More...
 
 sanitizeUrlData (&$urlData)
 Check if the passed URL object is correct or not. More...
 
 sanitizeSrvData (&$srvData)
 Check if the passed server upload object is correct or not. More...
 
 generateVcsUpload ($vcsData, $folderId, $fileDescription, $isPublic, $ignoreScm, $applyGlobal)
 
 generateUrlUpload ($urlData, $folderName, $fileDescription, $isPublic, $ignoreScm, $applyGlobal)
 
 generateSrvUpload ($srvData, $folderName, $fileDescription, $isPublic, $ignoreScm, $applyGlobal)
 
 getMainLicenses ($dbManager, $uploadId, $groupId)
 

Private Attributes

 $uploadFilePage
 
 $uploadVcsPage
 
 $uploadUrlPage
 
 $uploadSrvPage
 

Detailed Description

Handle new file uploads from Slim framework and move to FOSSology.

Definition at line 47 of file UploadHelper.php.

Constructor & Destructor Documentation

◆ __construct()

Fossology\UI\Api\Helper\UploadHelper::__construct ( )

Constructor to get UploadFilePage and UploadVcsPage objects.

Definition at line 95 of file UploadHelper.php.

Member Function Documentation

◆ createFileUpload()

Fossology\UI\Api\Helper\UploadHelper::createFileUpload (   $uploadedFile,
  $folderId,
  $fileDescription,
  $isPublic,
  $ignoreScm = 0,
  $applyGlobal = 0 
)
private

Create request required by UploadFilePage

Parameters
UploadedFile$uploadedFileUploaded file object
string$folderIdID of the folder to upload the file
string$fileDescriptionDescription of file uploaded
string$isPublicUpload is public, private or protected
integer$ignoreScm1 if the SCM should be ignored.
integer$applyGlobal1 if global decisions should be applied.
Returns
array Array with status, message and upload id

Definition at line 219 of file UploadHelper.php.

◆ createNewUpload()

Fossology\UI\Api\Helper\UploadHelper::createNewUpload (   $reqBody,
  $folderId,
  $fileDescription,
  $isPublic,
  $ignoreScm,
  $uploadType,
  $applyGlobal = false 
)

Get a request from Slim and translate to Symfony request to be processed by FOSSology

Parameters
array | null$reqBody
string$folderIdID of the folder to upload the file
string$fileDescriptionDescription of file uploaded
string$isPublicUpload is public, private or protected
boolean$ignoreScmTrue if the SCM should be ignored.
string$uploadTypeType of upload (if other than file)
boolean$applyGlobalTrue if global decisions should be applied.
Returns
array Array with status, message and upload id
See also
createVcsUpload()
createFileUpload()

Definition at line 171 of file UploadHelper.php.

◆ fetchClearingStatus()

Fossology\UI\Api\Helper\UploadHelper::fetchClearingStatus (   $itemTreeBounds,
  $clearingDao,
  $groupId 
)

Get the clearing status for files within an upload

Parameters
ItemTreeBounds$itemTreeBoundsItemTreeBounds object for the uploadtree
ClearingDao$clearingDaoClearingDao object
integer$groupIdgroupId of the user
Returns
string String containing the Clearing status message
Exceptions
ExceptionIn case decision type not found

Definition at line 712 of file UploadHelper.php.

◆ generateSrvUpload()

Fossology\UI\Api\Helper\UploadHelper::generateSrvUpload (   $srvData,
  $folderName,
  $fileDescription,
  $isPublic,
  $ignoreScm,
  $applyGlobal 
)
private

Generate the upload by calling handleRequest of HelperToUploadSrvPage

Parameters
array$srvDataInformation from POST
string$folderNameName of the folder
string$fileDescriptionDescription of the upload
string$isPublicUpload is public, private or protected
integer$ignoreScm1 if the SCM should be ignored.
integer$applyGlobal1 if global decisions should be applied.
Returns
array Array with status, message and upload id

Definition at line 526 of file UploadHelper.php.

◆ generateUrlUpload()

Fossology\UI\Api\Helper\UploadHelper::generateUrlUpload (   $urlData,
  $folderName,
  $fileDescription,
  $isPublic,
  $ignoreScm,
  $applyGlobal 
)
private

Generate the upload by calling handleRequest of HelperToUploadUrlPage

Parameters
array$urlDataInformation from POST
string$folderNameName of the folder
string$fileDescriptionDescription of the upload
string$isPublicUpload is public, private or protected
integer$ignoreScm1 if the SCM should be ignored.
integer$applyGlobal1 if global decisions should be applied.
Returns
array Array with status, message and upload id

Definition at line 481 of file UploadHelper.php.

◆ generateVcsUpload()

Fossology\UI\Api\Helper\UploadHelper::generateVcsUpload (   $vcsData,
  $folderId,
  $fileDescription,
  $isPublic,
  $ignoreScm,
  $applyGlobal 
)
private

Generate the upload by calling handleRequest of HelperToUploadVcsPage

Parameters
array$vcsDataInformation from POST
string$folderIdID of the folder
string$fileDescriptionDescription of the upload
string$isPublicUpload is public, private or protected
integer$ignoreScm1 if the SCM should be ignored.
boolean$applyGlobal1 if global decisions should be applied.
Returns
array Array with status, message and upload id

Definition at line 435 of file UploadHelper.php.

◆ getMainLicenses()

Fossology\UI\Api\Helper\UploadHelper::getMainLicenses (   $dbManager,
  $uploadId,
  $groupId 
)
private

Get main license selected for the upload

Parameters
DbManager$dbManagerDbManager object
integer$uploadIdUpload ID
integer$groupIdGroup ID
Returns
NULL|array

Definition at line 638 of file UploadHelper.php.

◆ handleScheduleAnalysis()

Fossology\UI\Api\Helper\UploadHelper::handleScheduleAnalysis (   $uploadId,
  $folderId,
  $scanOptionsJSON,
  $newUpload = false 
)

Schedule Analysis after the upload

Parameters
integer$uploadIdUpload ID
integer$folderIdFolder ID
array$scanOptionsJSONscanOptions
boolean$newUploadRequest is for new upload?
Returns
Info Response
Exceptions
HttpBadRequestExceptionIf no parameters are selected for agents
HttpForbiddenExceptionIf the user does not have write access to the upload
HttpNotFoundExceptionIf the folder does not contain the upload

Definition at line 114 of file UploadHelper.php.

◆ handleUpload()

Fossology\UI\Api\Helper\UploadHelper::handleUpload (   $body,
  $uploadType,
  $folderId,
  $fileDescription,
  $isPublic,
  $ignoreScm = 0,
  $applyGlobal = 0 
)
private

Create request required by Upload pages

Parameters
array$bodyParsed upload request
string$uploadTypeType of upload (url, vcs or server)
string$folderIdID of the folder to upload the file
string$fileDescriptionDescription of file uploaded
string$isPublicUpload is public, private or protected
integer$ignoreScm1 if the SCM should be ignored.
integer$applyGlobal1 if global decisions should be applied.
Returns
array Array with status, message and upload id

Definition at line 256 of file UploadHelper.php.

◆ sanitizeSrvData()

Fossology\UI\Api\Helper\UploadHelper::sanitizeSrvData ( $srvData)
private

Check if the passed server upload object is correct or not.

  1. Check if all the required parameters are passed by user.
  2. Add missing keys with empty data to prevent warnings.
Parameters
array$srvDataParsed server upload object to be sanitized
Returns
array|boolean True if everything is correct, error array otherwise

Definition at line 403 of file UploadHelper.php.

◆ sanitizeUrlData()

Fossology\UI\Api\Helper\UploadHelper::sanitizeUrlData ( $urlData)
private

Check if the passed URL object is correct or not.

  1. Check if all the required parameters are passed by user.
  2. Add missing keys with empty data to prevent warnings.
Parameters
array$urlDataParsed URL object to be sanitized
Returns
array|boolean True if everything is correct, error array otherwise

Definition at line 363 of file UploadHelper.php.

◆ sanitizeVcsData()

Fossology\UI\Api\Helper\UploadHelper::sanitizeVcsData ( $vcsData)
private

Check if the passed VCS object is correct or not.

  1. Check if all the required parameters are passed by user.
  2. Translate the vcsType to required values.
  3. Add missing keys with empty data to prevent warnings.
Parameters
array$vcsDataParsed VCS object to be sanitized
Returns
array|boolean True if everything is correct, error array otherwise

Definition at line 308 of file UploadHelper.php.

Member Data Documentation

◆ $uploadFilePage

HelperToUploadFilePage Fossology\UI\Api\Helper\UploadHelper::$uploadFilePage
private

Object to handle file based uploads

Definition at line 53 of file UploadHelper.php.

◆ $uploadSrvPage

HelperToUploadSrvPage Fossology\UI\Api\Helper\UploadHelper::$uploadSrvPage
private

Object to handle server based uploads

Definition at line 71 of file UploadHelper.php.

◆ $uploadUrlPage

HelperToUploadUrlPage Fossology\UI\Api\Helper\UploadHelper::$uploadUrlPage
private

Object to handle URL based uploads

Definition at line 65 of file UploadHelper.php.

◆ $uploadVcsPage

HelperToUploadVcsPage Fossology\UI\Api\Helper\UploadHelper::$uploadVcsPage
private

Object to handle VCS based uploads

Definition at line 59 of file UploadHelper.php.

◆ VALID_UPLOAD_TYPES

array Fossology\UI\Api\Helper\UploadHelper::VALID_UPLOAD_TYPES
Initial value:
= array(
"vcs",
"url",
"server"
)

Array of valid inputs for uploadType parameter

Definition at line 86 of file UploadHelper.php.

◆ VALID_VCS_TYPES

array Fossology\UI\Api\Helper\UploadHelper::VALID_VCS_TYPES
Initial value:
= array(
"git",
"svn"
)

Array of valid inputs for vcsType parameter

Definition at line 77 of file UploadHelper.php.


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