FOSSology
3.2.0rc1
Open Source License Compliance by Open Source Software
|
Provides helper methods to access database for REST api. More...
Public Member Functions | |
__construct (DbManager $dbManager) | |
getDbManager () | |
getUploads ($userId, $uploadId=null) | |
getFilenameFromUploadTree ($uploadTreePk) | |
doesIdExist ($tableName, $idRowName, $id) | |
deleteUser ($id) | |
getUsers ($id=null) | |
getJobs ($id=null, $limit=0, $page=1, $uploadId=null) | |
Get the recent jobs. More... | |
getTokenKey ($tokenId) | |
invalidateToken ($tokenId) | |
insertNewTokenKey ($userId, $expire, $scope, $name, $key) | |
getMaxTokenValidity () | |
Private Member Functions | |
checkTokenNameUnique ($userId, $tokenName) | |
checkTokenKeyUnique ($userId, $tokenKey) | |
Private Attributes | |
$dbManager | |
Provides helper methods to access database for REST api.
Definition at line 43 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::__construct | ( | DbManager | $dbManager | ) |
DbHelper constructor.
DbManager | $dbManager | DB manager in use |
Definition at line 56 of file DbHelper.php.
|
private |
Checks if the personal_access_tokens_token_key_ukey
constraint is followed by this token.
int | $userId | User id |
string | $tokenKey | Token secret key |
Definition at line 361 of file DbHelper.php.
|
private |
Checks if the personal_access_tokens_token_name_ukey
constraint is followed by this token.
int | $userId | User id |
string | $tokenName | Name of the token |
Definition at line 340 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::deleteUser | ( | $id | ) |
Delete the given user id
integer | $id | User id to be deleted |
Definition at line 151 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::doesIdExist | ( | $tableName, | |
$idRowName, | |||
$id | |||
) |
Check if a given id exists under given table.
string | $tableName | Table name |
string | $idRowName | ID column name |
string | $id | ID to check |
Definition at line 140 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::getDbManager | ( | ) |
Fossology\UI\Api\Helper\DbHelper::getFilenameFromUploadTree | ( | $uploadTreePk | ) |
Get first upload name under a given upload tree id
integer | $uploadTreePk | Upload tree id to check. |
Definition at line 125 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::getJobs | ( | $id = null , |
|
$limit = 0 , |
|||
$page = 1 , |
|||
$uploadId = null |
|||
) |
Get the recent jobs.
If a limit is passed, the results are trimmed. If an ID is passed, the information for the given id is only retrieved.
integer | $id | Set to get information of only given job id |
integer | $limit | Set to limit the result length |
integer | $page | Page number required |
integer | $uploadId | Upload ID to be filtered |
Definition at line 215 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::getMaxTokenValidity | ( | ) |
Get the value for maximum API token validity from sysconfig table.
Definition at line 379 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::getTokenKey | ( | $tokenId | ) |
Get the required information to validate a token based on token id.
int | $tokenId | Token id (primary key of the table). |
token_key
, created_on,
expire_onand
user_fk` for the given token id. Definition at line 280 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::getUploads | ( | $userId, | |
$uploadId = null |
|||
) |
Get the uploads under the given user id if not upload id is provided.
Get a single upload information under the given user and upload id.
integer | $userId | User to check |
integer | $uploadId | Pass the upload id to check for single upload. |
Definition at line 80 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::getUsers | ( | $id = null | ) |
Get the user under the given user id or every user from the database.
integer | $id | User id of the required user, or NULL to fetch all users. |
Definition at line 164 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::insertNewTokenKey | ( | $userId, | |
$expire, | |||
$scope, | |||
$name, | |||
$key | |||
) |
Insert a new token in the DB.
int | $userId | User of the new token |
string | $expire | When the token will expire |
string | $scope | Scope of the token |
string | $name | Name of the token |
string | $key | Secret key of the token |
DuplicateTokenNameException | If user already have a token with same name. |
DuplicateTokenKeyException | If user already have a token with same key. |
Definition at line 314 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::invalidateToken | ( | $tokenId | ) |
Mark a token as invalid/inactive.
int | $tokenId | The token to be marked as invalid |
Definition at line 293 of file DbHelper.php.
|
private |
DB manager in use
Definition at line 49 of file DbHelper.php.