FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
Fossology\UI\Api\Helper\RestHelper Class Reference

Provides various DAO helper functions for REST api. More...

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

Public Member Functions

 __construct (UploadPermissionDao $uploadPermissionDao, UploadDao $uploadDao, UserDao $userDao, FolderDao $folderDao, DbHelper $dbHelper, AuthHelper $authHelper, JobDao $jobDao, ShowJobsDao $showJobDao)
 RestHelper constructor. More...
 
 getUserId ()
 
 getGroupId ()
 
 getUploadDao ()
 
 getUserDao ()
 
 getFolderDao ()
 
 getUploadPermissionDao ()
 
 getAuthHelper ()
 
 getDbHelper ()
 
 getJobDao ()
 
 getShowJobDao ()
 
 copyUpload ($uploadId, $newFolderId, $isCopy)
 
 getPlugin ($pluginName)
 A safe wrapper around plugin_find. More...
 
 validateTokenRequest ($tokenExpire, $tokenName, $tokenScope)
 Check if the token request contains valid parameters. More...
 

Public Attributes

const VALID_SCOPES = ["read", "write"]
 
const SCOPE_DB_MAP = ["read" => "r"
 
const write => "w"]
 
const TOKEN_KEY_LENGTH = 40
 

Private Attributes

 $uploadDao
 
 $dbHelper
 
 $uploadPermissionDao
 
 $folderDao
 
 $userDao
 
 $jobDao
 
 $showJobDao
 
 $authHelper
 

Detailed Description

Provides various DAO helper functions for REST api.

Definition at line 40 of file RestHelper.php.

Constructor & Destructor Documentation

Fossology\UI\Api\Helper\RestHelper::__construct ( UploadPermissionDao  $uploadPermissionDao,
UploadDao  $uploadDao,
UserDao  $userDao,
FolderDao  $folderDao,
DbHelper  $dbHelper,
AuthHelper  $authHelper,
JobDao  $jobDao,
ShowJobsDao  $showJobDao 
)

RestHelper constructor.

This constructor initialize all the members

Definition at line 103 of file RestHelper.php.

Member Function Documentation

Fossology\UI\Api\Helper\RestHelper::copyUpload (   $uploadId,
  $newFolderId,
  $isCopy 
)

Copy/move a given upload id to a new folder id.

Parameters
integer$uploadIdUpload to copy/move
integer$newFolderIdNew folder id
boolean$isCopySet true to perform copy, false to move
Returns
Fossology::UI::Api::Models::Info

Definition at line 207 of file RestHelper.php.

Fossology\UI\Api\Helper\RestHelper::getAuthHelper ( )
Returns
AuthHelper

Definition at line 171 of file RestHelper.php.

Fossology\UI\Api\Helper\RestHelper::getDbHelper ( )
Returns
DbHelper

Definition at line 179 of file RestHelper.php.

Fossology\UI\Api\Helper\RestHelper::getFolderDao ( )
Returns
FolderDao

Definition at line 155 of file RestHelper.php.

Fossology\UI\Api\Helper\RestHelper::getGroupId ( )
Returns
integer Current group id

Definition at line 130 of file RestHelper.php.

Fossology\UI\Api\Helper\RestHelper::getJobDao ( )
Returns
JobDao

Definition at line 187 of file RestHelper.php.

Fossology\UI\Api\Helper\RestHelper::getPlugin (   $pluginName)

A safe wrapper around plugin_find.

Get the FOSSology plugin from the plugin array.

Parameters
string$pluginNameThe required plugin
Returns
Plugin The required plugin if found, else throws an exception.
Exceptions

Definition at line 248 of file RestHelper.php.

Fossology\UI\Api\Helper\RestHelper::getShowJobDao ( )
Returns
ShowJobsDao

Definition at line 195 of file RestHelper.php.

Fossology\UI\Api\Helper\RestHelper::getUploadDao ( )
Returns
UploadDao

Definition at line 139 of file RestHelper.php.

Fossology\UI\Api\Helper\RestHelper::getUploadPermissionDao ( )
Returns
UploadPermissionDao

Definition at line 163 of file RestHelper.php.

Fossology\UI\Api\Helper\RestHelper::getUserDao ( )
Returns
UserDao

Definition at line 147 of file RestHelper.php.

Fossology\UI\Api\Helper\RestHelper::getUserId ( )
Returns
integer Current user id

Definition at line 121 of file RestHelper.php.

Fossology\UI\Api\Helper\RestHelper::validateTokenRequest (   $tokenExpire,
  $tokenName,
  $tokenScope 
)

Check if the token request contains valid parameters.

The function checks for following properties:

  • The format of expiry parameter should be YYYY-MM-DD and should be +1 from now().
  • The length of token name should be between 0 and 40.
  • The scope of token should be valid.
Parameters
string$tokenExpireThe expiry of token requested.
string$tokenNameThe name of the token requested.
string$tokenScopeThe scope of the token requested.
Returns
boolean|Fossology::UI::Api::Models::Info True if all parameters are ok, else an info.

Definition at line 273 of file RestHelper.php.

Member Data Documentation

AuthHelper Fossology\UI\Api\Helper\RestHelper::$authHelper
private

Auth helper to provide authentication

Definition at line 96 of file RestHelper.php.

DbHelper Fossology\UI\Api\Helper\RestHelper::$dbHelper
private

DB helper object

Definition at line 66 of file RestHelper.php.

FolderDao Fossology\UI\Api\Helper\RestHelper::$folderDao
private

Folder DAO object

Definition at line 76 of file RestHelper.php.

JobDao Fossology\UI\Api\Helper\RestHelper::$jobDao
private

Job DAO object

Definition at line 86 of file RestHelper.php.

ShowJobsDao Fossology\UI\Api\Helper\RestHelper::$showJobDao
private

Show job DAO object

Definition at line 91 of file RestHelper.php.

UploadDao Fossology\UI\Api\Helper\RestHelper::$uploadDao
private

Upload DAO object

Definition at line 61 of file RestHelper.php.

UploadPermissionDao Fossology\UI\Api\Helper\RestHelper::$uploadPermissionDao
private

Upload permission DAO object

Definition at line 71 of file RestHelper.php.

UserDao Fossology\UI\Api\Helper\RestHelper::$userDao
private

User DAO object

Definition at line 81 of file RestHelper.php.

array Fossology\UI\Api\Helper\RestHelper::SCOPE_DB_MAP = ["read" => "r"

Maps a user readable scope to DB value.

Definition at line 51 of file RestHelper.php.

int Fossology\UI\Api\Helper\RestHelper::TOKEN_KEY_LENGTH = 40

Length of the token secret key.

Definition at line 56 of file RestHelper.php.

array Fossology\UI\Api\Helper\RestHelper::VALID_SCOPES = ["read", "write"]

Valid scopes for REST authentication tokens.

Definition at line 46 of file RestHelper.php.


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