PHP Class Scalr\Api\Rest\ApiApplication

Since: 5.4.0 (21.02.2015)
Author: Vitaliy Demidov ([email protected])
Inheritance: extends Application
Afficher le fichier Open project: scalr/scalr Class Usage Examples

Protected Properties

Свойство Type Description
$limiter Scalr\Api\Limiter API rate limiter

Méthodes publiques

Méthode Description
__construct ( array $settings = [] )
authenticationMiddleware ( ) Authentication middleware
checkPermissions ( $args ) Checks whether the authenticated user either is authorized to the specified object or has permission to ACL Role
delete ( $path, $options, $requirements = [] )
environmentAuthenticationMiddleware ( ) Environment level authentication middleware
error ( $e = null )
get ( $path, $options, $requirements = [] )
getAuditLoggerConfig ( )
getDefaultSettings ( ) Gets default settings
getEnvironment ( ) : Environment Gets User's Environment
getErrorEnvelope ( ) : Scalr\Api\DataType\ErrorEnvelope Gets API error envelope
getRouteHandler ( string $name ) : callable Gets the callback for the handler of the specified Route
getScope ( ) : string Gets current API request scope
getUser ( ) : User Gets authorized user
handleApiVersion ( $route )
handleEnvironment ( Scalr\Api\Rest\Routing\Route $route ) Scalr-Evironment middleware handler
hasPermissions ( ) : boolean Checks whether the authenticated user either is authorized to the specified object or has permission to ACL Role
invokeRoute ( string $name ) : mixed Invokes the named route with the list of the arguments and returns the result
notFound ( )
patch ( $path, $options, $requirements = [] )
post ( $path, $options, $requirements = [] )
preflightRequestHandlerMiddleware ( ) Preflight request middleware handler
put ( $path, $options, $requirements = [] )
redirectTo ( string $route, array $params = [], number $status = 302 ) Redirects to the specified named route
setEnvironment ( Environment $environment ) : ApiApplication Sets User's Environment
setUser ( User $user ) : ApiApplication Sets authorized user
setupRoutes ( ) : ApiApplication Sets up all API routes

Méthodes protégées

Méthode Description
defaultError ( $e = null )

Method Details

__construct() public méthode

See also: Scalr\Api\Rest\Application::__construct()
public __construct ( array $settings = [] )
$settings array

authenticationMiddleware() public méthode

Authentication middleware

checkPermissions() public méthode

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

defaultError() protected méthode

See also: Scalr\Api\Rest\Application::defaultError()
protected defaultError ( $e = null )

delete() public méthode

See also: Application::delete()
public delete ( $path, $options, $requirements = [] )

environmentAuthenticationMiddleware() public méthode

Environment level authentication middleware

error() public méthode

See also: Scalr\Api\Rest\Application::error()
public error ( $e = null )

get() public méthode

See also: Application::get()
public get ( $path, $options, $requirements = [] )

getAuditLoggerConfig() public méthode

See also: Scalr\LogCollector\AuditLoggerRetrieveConfigurationInterface::getAuditLoggerConfig()

getDefaultSettings() public static méthode

Gets default settings
public static getDefaultSettings ( )

getEnvironment() public méthode

Gets User's Environment
public getEnvironment ( ) : Environment
Résultat Scalr\Model\Entity\Account\Environment Returns Environment object

getErrorEnvelope() public méthode

Gets API error envelope
public getErrorEnvelope ( ) : Scalr\Api\DataType\ErrorEnvelope
Résultat Scalr\Api\DataType\ErrorEnvelope

getRouteHandler() public méthode

Gets the callback for the handler of the specified Route
public getRouteHandler ( string $name ) : callable
$name string The description of the handler _:
Résultat callable Returns the callable handler

getScope() public méthode

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

getUser() public méthode

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

handleApiVersion() public méthode

See also: Scalr\Api\Rest\Application::handleApiVersion()
public handleApiVersion ( $route )

handleEnvironment() public méthode

It extracts :environment group parameter from the route and sets application setting
public handleEnvironment ( Scalr\Api\Rest\Routing\Route $route )
$route Scalr\Api\Rest\Routing\Route A route

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

invokeRoute() public méthode

Invokes the named route with the list of the arguments and returns the result
public invokeRoute ( string $name ) : mixed
$name string The description of the handler _:
Résultat mixed Returns the result of the invoked handler of the specified Route

notFound() public méthode

See also: Scalr\Api\Rest\Application::notFound()
public notFound ( )

patch() public méthode

See also: Application::patch()
public patch ( $path, $options, $requirements = [] )

post() public méthode

See also: Application::post()
public post ( $path, $options, $requirements = [] )

preflightRequestHandlerMiddleware() public méthode

Preflight request middleware handler

put() public méthode

See also: Application::put()
public put ( $path, $options, $requirements = [] )

redirectTo() public méthode

Redirects to the specified named route
public redirectTo ( string $route, array $params = [], number $status = 302 )
$route string The name of the Route
$params array optional The list of the parameters
$status number optional The HTTP response status code.

setEnvironment() public méthode

Sets User's Environment
public setEnvironment ( Environment $environment ) : ApiApplication
$environment Scalr\Model\Entity\Account\Environment The Environment object
Résultat ApiApplication

setUser() public méthode

Sets authorized user
public setUser ( User $user ) : ApiApplication
$user Scalr\Model\Entity\Account\User The user object
Résultat ApiApplication

setupRoutes() public méthode

Sets up all API routes
public setupRoutes ( ) : ApiApplication
Résultat ApiApplication Returns current instance

Property Details

$limiter protected_oe property

API rate limiter
protected Limiter,Scalr\Api $limiter
Résultat Scalr\Api\Limiter