PHP Class Scalr\Api\Rest\ApiApplication

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

Protected Properties

Property Type Description
$limiter Scalr\Api\Limiter API rate limiter

Public Methods

Method 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

Protected Methods

Method Description
defaultError ( $e = null )

Method Details

__construct() public method

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

authenticationMiddleware() public method

Authentication middleware

checkPermissions() public method

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

defaultError() protected method

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

delete() public method

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

environmentAuthenticationMiddleware() public method

Environment level authentication middleware

error() public method

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

get() public method

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

getAuditLoggerConfig() public method

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

getDefaultSettings() public static method

Gets default settings
public static getDefaultSettings ( )

getEnvironment() public method

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

getErrorEnvelope() public method

Gets API error envelope
public getErrorEnvelope ( ) : Scalr\Api\DataType\ErrorEnvelope
return Scalr\Api\DataType\ErrorEnvelope

getRouteHandler() public method

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

getScope() public method

Gets current API request scope
public getScope ( ) : string
return string Returns scope

getUser() public method

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

handleApiVersion() public method

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

handleEnvironment() public method

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 method

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

invokeRoute() public method

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 _:
return mixed Returns the result of the invoked handler of the specified Route

notFound() public method

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

patch() public method

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

post() public method

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

preflightRequestHandlerMiddleware() public method

Preflight request middleware handler

put() public method

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

redirectTo() public method

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 method

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

setUser() public method

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

setupRoutes() public method

Sets up all API routes
public setupRoutes ( ) : ApiApplication
return ApiApplication Returns current instance

Property Details

$limiter protected_oe property

API rate limiter
protected Limiter,Scalr\Api $limiter
return Scalr\Api\Limiter