PHP Class Scalr\Api\Rest\Controller\ApiController

Since: 5.4.0 (12.02.2015)
Author: Vitaliy Demidov ([email protected])
Inheritance: extends Scalr\Api\Rest\Controller\AbstractController
Afficher le fichier Open project: scalr/scalr Class Usage Examples

Protected Properties

Свойство Type Description
$app Scalr\Api\Rest\ApiApplication Application instance

Méthodes publiques

Méthode Description
__call ( $method, $args )
adapter ( string $name, string $scope = null, string $version = null ) : ApiEntityAdapter Gets a new Instance of the adapter
auditLog ( string $event, variadic $extra ) : boolean AuditLogger wrapper
checkPermissions ( $args ) Checks whether the authenticated user either is authorized to the specified object or has permission to ACL Role
checkScopedPermissions ( string $resourceMnemonic, string $permissionMnemonic = null ) Checks whether the authenticated user either is authorized has permission to ACL Role
getApplication ( ) : ApiApplication Gets Application
getBareId ( object $object, string $item = null ) : mixed Gets bare id from request object
getCommonQueryParams ( ) : array Gets common query parameters
getEnvironment ( ) : Environment Gets Environment from the current request
getMaxResults ( ) : integer Gets the maximum records per page
getPageNum ( ) : integer Gets the number of the page
getPageOffset ( ) : integer Gets the page offset
getPagination ( integer $foundRows ) : Scalr\Api\DataType\Pagination Gets pagination object
getScope ( ) : string Gets current API request scope
getScopeCriteria ( string $scope = null, $strictToScope = false ) : array Gets criteria corresponding current API request scope
getUser ( ) : User Gets authenticated user
hasPermissions ( ) : boolean Checks whether the authenticated user either is authorized to the specified object or has permission to ACL Role
params ( string $name = null, string $default = null ) : string | array Gets GET request parameter
result ( mixed $data ) : Scalr\Api\DataType\ResultEnvelope Gets result envelope for the response
resultList ( mixed $data, string | null $foundRows = null ) : Scalr\Api\DataType\ListResultEnvelope Gets the list result envelope for the response
setApplication ( ApiApplication $app ) : ApiController Sets API Application instance

Private Methods

Méthode Description
generateLink ( array &$params, boolean $sort = false ) : string Generates link using specified query params
processCommonQueryParameters ( ) Processes and validates common query parameters from the request

Method Details

__call() public méthode

public __call ( $method, $args )

adapter() public méthode

Gets a new Instance of the adapter
public adapter ( string $name, string $scope = null, string $version = null ) : ApiEntityAdapter
$name string The name of the adapter
$scope string optional The scope of the adapter
$version string optional The version of the adapter
Résultat Scalr\Api\DataType\ApiEntityAdapter Returns the instance of the specified adapter

auditLog() public méthode

AuditLogger wrapper
public auditLog ( string $event, variadic $extra ) : boolean
$event string Event name, aka tag
$extra variadic optional Array of additionally provided information
Résultat boolean Whether operation was successful

checkPermissions() public méthode

checkPermissions(object $obj, bool $modify = false, $errorMessage='') checkPermissions(int $roleId, string $permissionId = null, $errorMessage='')
public checkPermissions ( $args )

checkScopedPermissions() public méthode

Checks whether the authenticated user either is authorized has permission to ACL Role
public checkScopedPermissions ( string $resourceMnemonic, string $permissionMnemonic = null )
$resourceMnemonic string ACL resource name
$permissionMnemonic string optional ACL permission name

getApplication() public méthode

Gets Application
public getApplication ( ) : ApiApplication
Résultat Scalr\Api\Rest\ApiApplication

getBareId() public static méthode

Gets bare id from request object
public static getBareId ( object $object, string $item = null ) : mixed
$object object Request object
$item string optional Item name (image, role) or null, if object is target
Résultat mixed

getCommonQueryParams() public méthode

Gets common query parameters
public getCommonQueryParams ( ) : array
Résultat array Returns array of common query parameters looks like [name => value]

getEnvironment() public méthode

Gets Environment from the current request
public getEnvironment ( ) : Environment
Résultat Scalr\Model\Entity\Account\Environment

getMaxResults() public méthode

Gets the maximum records per page
public getMaxResults ( ) : integer
Résultat integer Returns maximum records per page

getPageNum() public méthode

Gets the number of the page
public getPageNum ( ) : integer
Résultat integer Returns the number of the page

getPageOffset() public méthode

Gets the page offset
public getPageOffset ( ) : integer
Résultat integer Returns page offset

getPagination() public méthode

Gets pagination object
public getPagination ( integer $foundRows ) : Scalr\Api\DataType\Pagination
$foundRows integer The number of records found
Résultat Scalr\Api\DataType\Pagination Returns pagination object

getScope() public méthode

Gets current API request scope
public getScope ( ) : string
Résultat string Returns scope

getScopeCriteria() public méthode

Gets criteria corresponding current API request scope
public getScopeCriteria ( string $scope = null, $strictToScope = false ) : array
$scope string optional Scope override
Résultat array Returns criteria

getUser() public méthode

Gets authenticated user
public getUser ( ) : User
Résultat Scalr\Model\Entity\Account\User

hasPermissions() public méthode

hasPermissions(object $obj, bool $modify = false) hasPermissions(int $roleId, string $permissionId = null)
public hasPermissions ( ) : boolean
Résultat boolean Returns TRUE if the authenticated user has access or FALSE otherwise

params() final public méthode

If common query parameter is used
final public params ( string $name = null, string $default = null ) : string | array
$name string The name of the parameter
$default string optional The default value of the parameter
Résultat string | array Returns the value of the param. If the name is not specified it returns all query params

result() public méthode

Gets result envelope for the response
public result ( mixed $data ) : Scalr\Api\DataType\ResultEnvelope
$data mixed The response data
Résultat Scalr\Api\DataType\ResultEnvelope Returns result envelope object depends on specified data

resultList() public méthode

Gets the list result envelope for the response
public resultList ( mixed $data, string | null $foundRows = null ) : Scalr\Api\DataType\ListResultEnvelope
$data mixed The list of the objects which should be responded with
$foundRows string | null optional The number of the found rows to inject Pagination into envelope
Résultat Scalr\Api\DataType\ListResultEnvelope Returns list result

setApplication() public méthode

Sets API Application instance
public setApplication ( ApiApplication $app ) : ApiController
$app Scalr\Api\Rest\ApiApplication API Application instance
Résultat ApiController

Property Details

$app protected_oe property

Application instance
protected ApiApplication,Scalr\Api\Rest $app
Résultat Scalr\Api\Rest\ApiApplication