PHP Class ScalrAPICore

Exibir arquivo Open project: scalr/scalr

Public Properties

Property Type Description
$Version

Protected Properties

Property Type Description
$DB ADODB_mysqli
$Environment Scalr_Environment
$LastTransactionID
$Request
$aclRoles Scalr\Acl\Role\AccountRoleSuperposition Acl role superposition object for current user's session
$debug
$user Scalr_Account_User

Public Methods

Method Description
BuildRestServer ( $request )
__construct ( $version )
getAuditLoggerConfig ( )
getFarmSqlQuery ( string $permissionId = null ) : string Generate conditions for sql query to limit access by only allowable farms.

Protected Methods

Method Description
CreateInitialResponse ( )
IPAccessCheck ( $allowed_ips )
LogRequest ( $trans_id, $action, $ipaddr, $request, $response )
ObjectToXML ( $obj, $DOMElement, $DOMDocument )
auditLog ( string $event, variadic $extra ) : boolean AuditLogger wrapper
getAclRoles ( ) : Scalr\Acl\Role\AccountRoleSuperposition Gets acl roles superposition for the request
getContainer ( ) : Container Gets DI Container
insensitiveUksort ( $a, $b )
isAllowed ( integer $resourceId, string $permissionId = null ) : boolean Checks if access to ACL resource or unique permission is allowed
isFarmAllowed ( DBFarm $dbFarm = null, string $permissionId = null ) : boolean
restrictAccess ( integer $resourceId, string $permissionId = null ) Checks if access to ACL resource or unique permission is allowed and throws an exception if negative.
restrictFarmAccess ( DBFarm $dbFarm = null, null $permissionId = null )
stripValue ( $value )

Private Methods

Method Description
AuthenticateLdap ( $request )
AuthenticateREST ( $request )
AuthenticateRESTv2 ( $request )
AuthenticateRESTv3 ( $request )
setDiContainer ( ) Sets necessary stuff into DI container

Method Details

BuildRestServer() public method

public BuildRestServer ( $request )

CreateInitialResponse() protected method

protected CreateInitialResponse ( )

IPAccessCheck() protected method

protected IPAccessCheck ( $allowed_ips )

LogRequest() protected method

protected LogRequest ( $trans_id, $action, $ipaddr, $request, $response )

ObjectToXML() protected method

protected ObjectToXML ( $obj, $DOMElement, $DOMDocument )

__construct() public method

public __construct ( $version )

auditLog() protected method

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

getAclRoles() protected method

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

getAuditLoggerConfig() public method

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

getContainer() protected method

Gets DI Container
protected getContainer ( ) : Container
return Scalr\DependencyInjection\Container

getFarmSqlQuery() public method

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

insensitiveUksort() protected method

protected insensitiveUksort ( $a, $b )

isAllowed() protected method

Usage: -- use \Scalr\Acl\Acl; it is somewhere inside controller action method $this->isAllowed(Acl::RESOURCE_FARMS, Acl::PERM_FARMS_MANAGE); or you can do something like that $this->isAllowed('FARMS', 'manage');
protected isAllowed ( integer $resourceId, string $permissionId = null ) : boolean
$resourceId integer The ID of the ACL resource or its symbolic name without "RESOURCE_" prefix.
$permissionId string optional The ID of the uniqure permission which is related to specified resource.
return boolean Returns TRUE if access is allowed

isFarmAllowed() protected method

protected isFarmAllowed ( DBFarm $dbFarm = null, string $permissionId = null ) : boolean
$dbFarm DBFarm
$permissionId string
return boolean

restrictAccess() protected method

Checks if access to ACL resource or unique permission is allowed and throws an exception if negative.
protected restrictAccess ( integer $resourceId, string $permissionId = null )
$resourceId integer The ID of the ACL resource or its symbolic name without "RESOURCE_" prefix.
$permissionId string optional The ID of the uniqure permission which is related to specified resource.

restrictFarmAccess() protected method

protected restrictFarmAccess ( DBFarm $dbFarm = null, null $permissionId = null )
$dbFarm DBFarm
$permissionId null

stripValue() protected method

protected stripValue ( $value )

Property Details

$DB protected_oe property

protected ADODB_mysqli $DB
return ADODB_mysqli

$Environment protected_oe property

protected Scalr_Environment $Environment
return Scalr_Environment

$LastTransactionID protected_oe property

protected $LastTransactionID

$Request protected_oe property

protected $Request

$Version public_oe property

public $Version

$aclRoles protected_oe property

Acl role superposition object for current user's session
protected AccountRoleSuperposition,Scalr\Acl\Role $aclRoles
return Scalr\Acl\Role\AccountRoleSuperposition

$debug protected_oe property

protected $debug

$user protected_oe property

protected Scalr_Account_User $user
return Scalr_Account_User