PHP Class Scalr_UI_Request

Afficher le fichier Open project: scalr/scalr Class Usage Examples

Méthodes publiques

Свойство Type Description
$requestApiVersion

Protected Properties

Свойство Type Description
$aclRoles Scalr\Acl\Role\AccountRoleSuperposition Acl roles for this user and environment
$clientIp
$definitions
$environment
$paramErrors
$params
$paramsIsValid
$requestFiles
$requestHeaders
$requestParams
$requestServer
$requestType
$scope
$user Scalr_Account_User

Méthodes publiques

Méthode Description
__construct ( $type, $headers, $server, $params, $files )
addValidationErrors ( $field, $errors )
checkPermissions ( object $object, boolean | string $modify = null ) Check whether the user has access permissions to the specified object
defineParams ( $defs )
getAclRoles ( ) : Scalr\Acl\Role\AccountRoleSuperposition Gets acl roles superposition for the request
getAuditLoggerConfig ( )
getClientIp ( ) Gets client ip address for the current request
getClientIpAddress ( ) : string Gets client ip address
getCloudResourceFilteringDecision ( integer $resourceId, string $platform = SERVER_PLATFORMS::EC2, string $farmId = null ) : Scalr\Acl\Resource\CloudResourceFilteringDecision Gets Cloud Resource filtering decision for the specified ACL resource
getEnvironment ( ) : Scalr_Environment Gets an environment instance which is associated with the request
getFarmSqlQuery ( string $permissionId = null ) : string Generate conditions for sql query to limit access by only allowable farms.
getFileName ( $name )
getHeaderVar ( $name )
getInstance ( ) : Scalr_UI_Request
getParam ( $key, boolean $rawValue = false ) : mixed
getParams ( )
getRemoteAddr ( ) : string Gets User's IP
getRequestParam ( $key )
getRequestType ( )
getScope ( )
getUser ( ) : Scalr_Account_User
getValidationErrors ( )
getValidationErrorsMessage ( )
hasParam ( $key )
hasPermissions ( object $object, boolean | string $modify = null ) : boolean Check whether the user has access permissions to the specified object
initializeInstance ( $type, $headers, $server, $params, $files, $userId, $envId = null ) : Scalr_UI_Request
isAllowed ( integer | string | array $resourceId, string $permissionId = null ) : boolean Checks if access to ACL resource or unique permission is allowed
isFarmDesignerAllowed ( ) : boolean Checks whether user has access to FarmDesigner
isInterfaceBeta ( )
isInterfaceBetaOrNotHostedScalr ( ) : boolean Checks whether either it is beta version of interface or not hosted scalr install
isValid ( )
restrictAccess ( $resourceId, $permissionId = null )
restrictFarmDesignerAccess ( ) Checks whether user has access to FarmDesigner
setParam ( $key, $value )
setParams ( $params )
stripValue ( $value ) : string clear string from prohibited symbols
validate ( ) : Scalr_UI_Request

Method Details

__construct() public méthode

public __construct ( $type, $headers, $server, $params, $files )

addValidationErrors() public méthode

public addValidationErrors ( $field, $errors )
$field string
$errors array|string

checkPermissions() public méthode

Check whether the user has access permissions to the specified object
public checkPermissions ( object $object, boolean | string $modify = null )
$object object
$modify boolean | string

defineParams() public méthode

public defineParams ( $defs )

getAclRoles() public méthode

Gets acl roles superposition for the request
public getAclRoles ( ) : Scalr\Acl\Role\AccountRoleSuperposition
Résultat Scalr\Acl\Role\AccountRoleSuperposition

getAuditLoggerConfig() public méthode

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

getClientIp() public méthode

Gets client ip address for the current request
public getClientIp ( )

getClientIpAddress() public static méthode

Gets client ip address
public static getClientIpAddress ( ) : string
Résultat string Returns client ip address.

getCloudResourceFilteringDecision() public méthode

Gets Cloud Resource filtering decision for the specified ACL resource
public getCloudResourceFilteringDecision ( integer $resourceId, string $platform = SERVER_PLATFORMS::EC2, string $farmId = null ) : Scalr\Acl\Resource\CloudResourceFilteringDecision
$resourceId integer ACL Resource ID which should have defined Mode which is the instance of CloudResourceScopeMode
$platform string optional The Cloud Platform TODO It isn't supported yet
$farmId string optional The Farm identifier
Résultat Scalr\Acl\Resource\CloudResourceFilteringDecision Returns decision object

getEnvironment() public méthode

Gets an environment instance which is associated with the request
public getEnvironment ( ) : Scalr_Environment
Résultat Scalr_Environment

getFarmSqlQuery() public méthode

Table farms should have alias f.
public getFarmSqlQuery ( string $permissionId = null ) : string
$permissionId string optional
Résultat string

getFileName() public méthode

public getFileName ( $name )

getHeaderVar() public méthode

public getHeaderVar ( $name )

getInstance() public static méthode

public static getInstance ( ) : Scalr_UI_Request
Résultat Scalr_UI_Request

getParam() public méthode

Deprecation: all parameters should be defined in function's arguments
public getParam ( $key, boolean $rawValue = false ) : mixed
$key
$rawValue boolean if true returns rawValue (not stripped) only once, don't save in cache
Résultat mixed

getParams() public méthode

public getParams ( )

getRemoteAddr() public méthode

Gets User's IP
public getRemoteAddr ( ) : string
Résultat string Returns User's IP

getRequestParam() public méthode

public getRequestParam ( $key )

getRequestType() public méthode

public getRequestType ( )

getScope() public méthode

public getScope ( )

getUser() public méthode

public getUser ( ) : Scalr_Account_User
Résultat Scalr_Account_User

getValidationErrors() public méthode

public getValidationErrors ( )

getValidationErrorsMessage() public méthode

hasParam() public méthode

public hasParam ( $key )

hasPermissions() public méthode

Check whether the user has access permissions to the specified object
public hasPermissions ( object $object, boolean | string $modify = null ) : boolean
$object object
$modify boolean | string
Résultat boolean Returns TRUE if the authenticated user has access or FALSE otherwise

initializeInstance() public static méthode

public static initializeInstance ( $type, $headers, $server, $params, $files, $userId, $envId = null ) : Scalr_UI_Request
$type
$headers
$server
$params
$files
$userId
$envId int optional Could be null, when we check headers (for UI)
Résultat Scalr_UI_Request

isAllowed() public méthode

Usage: -- use \Scalr\Acl\Acl; The ID of the ACL resource; The ID of the unique permission which is related to specified resource $this->request->isAllowed(Acl::RESOURCE_FARMS, Acl::PERM_FARMS_EDIT); Array of IDs of the ACL resource (check if user have any permission); The ID of the unique permission which is related to specified resource $this->request->isAllowed([Acl::RESOURCE_FARMS, Acl::RESOURCE_OWN_FARMS], Acl::PERM_FARMS_EDIT); Mnemonic constants: resource, permission Method interprets $resourceMnemonic as RESOURCE_$resourceMnemonic_$scope, $permissionMnemonic as PERM_$resourceMnemonic_$scope_$permissionMnemonic For example, call(ROLES, MANAGE) on account scope will check RESOURCE_ROLES_ACCOUNT, PERM_ROLES_ACCOUNT_MANAGE $this->request->isAllowed('ROLES', 'MANAGE');
public isAllowed ( integer | string | array $resourceId, string $permissionId = null ) : boolean
$resourceId integer | string | array The ID or Name of the ACL resource or array of resources
$permissionId string optional The ID or Name of the unique permission which is related to specified resource.
Résultat boolean Returns TRUE if access is allowed

isFarmDesignerAllowed() public méthode

Checks whether user has access to FarmDesigner
public isFarmDesignerAllowed ( ) : boolean
Résultat boolean

isInterfaceBeta() public méthode

public isInterfaceBeta ( )

isInterfaceBetaOrNotHostedScalr() public méthode

Checks whether either it is beta version of interface or not hosted scalr install
public isInterfaceBetaOrNotHostedScalr ( ) : boolean
Résultat boolean Returns true if it is either a beta version of interface or it isn't hosted scalr install

isValid() public méthode

public isValid ( )

restrictAccess() public méthode

See also: Scalr_UI_Controller_Request::isAllowed
public restrictAccess ( $resourceId, $permissionId = null )

restrictFarmDesignerAccess() public méthode

Checks whether user has access to FarmDesigner

setParam() public méthode

public setParam ( $key, $value )

setParams() public méthode

public setParams ( $params )

stripValue() public méthode

clear string from prohibited symbols
public stripValue ( $value ) : string
$value string
Résultat string

validate() public méthode

public validate ( ) : Scalr_UI_Request
Résultat Scalr_UI_Request

Property Details

$aclRoles protected_oe property

Acl roles for this user and environment
protected AccountRoleSuperposition,Scalr\Acl\Role $aclRoles
Résultat Scalr\Acl\Role\AccountRoleSuperposition

$clientIp protected_oe property

protected $clientIp

$definitions protected_oe property

protected $definitions

$environment protected_oe property

protected $environment

$paramErrors protected_oe property

protected $paramErrors

$params protected_oe property

protected $params

$paramsIsValid protected_oe property

protected $paramsIsValid

$requestApiVersion public_oe property

public $requestApiVersion

$requestFiles protected_oe property

protected $requestFiles

$requestHeaders protected_oe property

protected $requestHeaders

$requestParams protected_oe property

protected $requestParams

$requestServer protected_oe property

protected $requestServer

$requestType protected_oe property

protected $requestType

$scope protected_oe property

protected $scope

$user protected_oe property

protected Scalr_Account_User $user
Résultat Scalr_Account_User