PHP Class Scalr_UI_Request

Mostrar archivo Open project: scalr/scalr Class Usage Examples

Public Properties

Property Type Description
$requestApiVersion

Protected Properties

Property 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

Public Methods

Method 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 method

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

addValidationErrors() public method

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

checkPermissions() public method

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 method

public defineParams ( $defs )

getAclRoles() public method

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

getAuditLoggerConfig() public method

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

getClientIp() public method

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

getClientIpAddress() public static method

Gets client ip address
public static getClientIpAddress ( ) : string
return string Returns client ip address.

getCloudResourceFilteringDecision() public method

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
return Scalr\Acl\Resource\CloudResourceFilteringDecision Returns decision object

getEnvironment() public method

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

getFarmSqlQuery() public method

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

getFileName() public method

public getFileName ( $name )

getHeaderVar() public method

public getHeaderVar ( $name )

getInstance() public static method

public static getInstance ( ) : Scalr_UI_Request
return Scalr_UI_Request

getParam() public method

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
return mixed

getParams() public method

public getParams ( )

getRemoteAddr() public method

Gets User's IP
public getRemoteAddr ( ) : string
return string Returns User's IP

getRequestParam() public method

public getRequestParam ( $key )

getRequestType() public method

public getRequestType ( )

getScope() public method

public getScope ( )

getUser() public method

public getUser ( ) : Scalr_Account_User
return Scalr_Account_User

getValidationErrors() public method

public getValidationErrors ( )

getValidationErrorsMessage() public method

hasParam() public method

public hasParam ( $key )

hasPermissions() public method

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
return boolean Returns TRUE if the authenticated user has access or FALSE otherwise

initializeInstance() public static method

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)
return Scalr_UI_Request

isAllowed() public method

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.
return boolean Returns TRUE if access is allowed

isFarmDesignerAllowed() public method

Checks whether user has access to FarmDesigner
public isFarmDesignerAllowed ( ) : boolean
return boolean

isInterfaceBeta() public method

public isInterfaceBeta ( )

isInterfaceBetaOrNotHostedScalr() public method

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

isValid() public method

public isValid ( )

restrictAccess() public method

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

restrictFarmDesignerAccess() public method

Checks whether user has access to FarmDesigner

setParam() public method

public setParam ( $key, $value )

setParams() public method

public setParams ( $params )

stripValue() public method

clear string from prohibited symbols
public stripValue ( $value ) : string
$value string
return string

validate() public method

public validate ( ) : Scalr_UI_Request
return Scalr_UI_Request

Property Details

$aclRoles protected_oe property

Acl roles for this user and environment
protected AccountRoleSuperposition,Scalr\Acl\Role $aclRoles
return 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
return Scalr_Account_User