FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
Provides helper methods to access database for REST api. More...
Public Member Functions | |
__construct (DbManager $dbManager, FolderDao $folderDao, UploadDao $uploadDao) | |
getDbManager () | |
getUploads ($userId, $groupId, $limit, $page=1, $uploadId=null, $options=null, $recursive=true, $apiVersion=ApiVersion::V1) | |
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... | |
getUserJobs ($id=null, $uid=null, $limit=0, $page=1, $uploadId=null) | |
Get the recent jobs created by an user. More... | |
getTokenKey ($tokenId) | |
invalidateToken ($tokenId) | |
insertNewTokenKey ($userId, $expire, $scope, $name, $key) | |
addNewClient ($name, $userId, $clientId, $scope) | |
getMaxTokenValidity () | |
getPfileInfoForUpload ($uploadId) | |
getLicensesPaginated ($page, $limit, $kind, $groupId, $active) | |
getLicenseCount ($kind, $groupId) | |
getTokenIdFromClientId ($clientId) | |
Private Member Functions | |
checkTokenNameUnique ($userId, $tokenName) | |
checkTokenKeyUnique ($userId, $tokenKey) | |
getFolderForUpload ($uploadId) | |
Private Attributes | |
$dbManager | |
$folderDao | |
$uploadDao | |
Provides helper methods to access database for REST api.
Definition at line 37 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::__construct | ( | DbManager | $dbManager, |
FolderDao | $folderDao, | ||
UploadDao | $uploadDao | ||
) |
DbHelper constructor.
DbManager | $dbManager | DB manager in use |
FolderDao | $folderDao | Folder Dao to use |
UploadDao | $uploadDao | Upload Dao to use |
Definition at line 64 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::addNewClient | ( | $name, | |
$userId, | |||
$clientId, | |||
$scope | |||
) |
Adds new oauth client to the user.
string | $name | Name of the new client |
integer | $userId | User PK |
string | $clientId | New client ID |
string | $scope | Token scope |
Definition at line 498 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 537 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 516 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 239 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 227 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 212 of file DbHelper.php.
|
private |
Get the folder for given upload
integer | $uploadId | Upload to get folder for |
Definition at line 589 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 302 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::getLicenseCount | ( | $kind, | |
$groupId | |||
) |
Get the count of licenses accessible by user based on group ID
string | $kind | Which kind of licenses to look for |
integer | $groupId | Group of the user |
Definition at line 638 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::getLicensesPaginated | ( | $page, | |
$limit, | |||
$kind, | |||
$groupId, | |||
$active | |||
) |
Get the licenses from database in paginated way
integer | $page | Which page number to fetch |
integer | $limit | Limit of results |
string | $kind | Which kind of licenses to fetch |
integer | $groupId | Group of the user |
boolean | $active | True to get only active licenses |
Definition at line 607 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::getMaxTokenValidity | ( | ) |
Get the value for maximum API token validity from sysconfig table.
Definition at line 555 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::getPfileInfoForUpload | ( | $uploadId | ) |
Get all info from pfile for given upload
integer | $uploadId | Upload to get info for |
Definition at line 572 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 438 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::getUploads | ( | $userId, | |
$groupId, | |||
$limit, | |||
$page = 1 , |
|||
$uploadId = null , |
|||
$options = null , |
|||
$recursive = true , |
|||
$apiVersion = ApiVersion::V1 |
|||
) |
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 | $groupId | Group trying to access |
integer | $limit | Max number of results |
integer | $page | Page to get |
integer | $uploadId | Pass the upload id to check for single upload. |
integer | $options | Filter options |
bool | $recursive | True to recursive listing of uploads |
Definition at line 97 of file DbHelper.php.
Fossology\UI\Api\Helper\DbHelper::getUserJobs | ( | $id = null , |
|
$uid = null , |
|||
$limit = 0 , |
|||
$page = 1 , |
|||
$uploadId = null |
|||
) |
Get the recent jobs created by an user.
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 | $uid | Set to get information of only given user's ID |
integer | $limit | Set to limit the result length |
integer | $page | Page number required |
integer | $uploadId | Upload ID to be filtered |
Definition at line 374 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 252 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 472 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 451 of file DbHelper.php.
|
private |
DB manager in use
Definition at line 43 of file DbHelper.php.
|
private |
FolderDao object
Definition at line 49 of file DbHelper.php.
|
private |
UploadDao object
Definition at line 55 of file DbHelper.php.