model/modx/modaccessibleobject.class.php

Classes 
package
modx
Classes
modAccessibleObject

Description

Defines an interface to provide configurable access policies for principals.

\modAccessibleObject

Extends from
\xPDOObject
package
modx
Properties
$_policies
Methods
_loadCollectionInstance
_loadInstance
checkPolicy
findPolicy
getPolicies
load
loadCollection
remove
save
setPolicies

Description

Defines an interface to provide configurable access policies for principals.

This is the basis for the entire xPDO object model, and can also be used by a class generator {@link xPDOGenerator}, ultimately allowing custom classes to be user-defined in a web interface and framework-generated at runtime.

Properties

$_policies

array $_policies = 'array'

A local cache of access policies for the instance.

Details

array
visibility
protected
default
array
final
false
static
false

Methods

_loadCollectionInstance

_loadCollectionInstance( \xPDO $xpdo, array $objCollection, string $className, mixed $criteria,  $row,  $fromCache, boolean|integer $cacheFlag = true ) :

Custom instance loader for collections that respects policy checking.

{@inheritdoc}

Arguments
$xpdo
\xPDO
&$xpdo A valid xPDO instance.
$objCollection
array
&$objCollection The collection to load the instance into.
$className
string
Name of the class.
$criteria
mixed
A valid primary key, criteria array, or xPDOCriteria instance.
$row
$fromCache
$cacheFlag
booleaninteger
Indicates if the objects should be cached and optionally, by specifying an integer value, for how many seconds.
Details
visibility
public
final
false
static
true

_loadInstance

_loadInstance( \xPDO $xpdo, string $className, \xPDOQuery|string $criteria, array $row ) : \xPDOObject

Custom instance from row loader that respects policy checking

{@inheritdoc}

Arguments
$xpdo
\xPDO
&$xpdo A valid xPDO instance.
$className
string
Name of the class.
$criteria
\xPDOQuerystring
A valid xPDOQuery instance or relation alias.
$row
array
The associative array containing the instance data.
Output
\xPDOObject
A new xPDOObject derivative representing a data row.
Details
visibility
public
final
false
static
true

checkPolicy

checkPolicy( array $criteria, string|array $targets = null ) : boolean

Determine if the current user attributes satisfy the object policy.

Arguments
$criteria
array
An associative array providing a key and value to search for within the matched policy attributes between policy and principal.
$targets
stringarray
A target modAccess class name or an array of class names to limit the check. In most cases, this does not need to be set; derivatives should typically determine what targets to include in the findPolicy() implementation.
Output
boolean
Returns true if the policy is satisfied or no policy exists.
Details
visibility
public
final
false
static
false

findPolicy

findPolicy( string $context ) : array

Find access policies applicable to this object in a specific context.

Arguments
$context
string
A key identifying a specific context to use when searching for the applicable policies. If not provided, the current context is used.
Output
array
An array of access policies for this object; an empty array is returned if no policies are assigned to the object.
Details
visibility
public
final
false
static
false
access
protected

getPolicies

getPolicies( ) :
Details
visibility
public
final
false
static
false

load

load( \xPDO $xpdo, string $className, mixed $criteria, boolean|integer $cacheFlag = true ) : object|null

Custom instance loader that forces access policy checking.

{@inheritdoc}

Arguments
$xpdo
\xPDO
&$xpdo A valid xPDO instance.
$className
string
Name of the class.
$criteria
mixed
A valid primary key, criteria array, or xPDOCriteria instance.
$cacheFlag
booleaninteger
Indicates if the objects should be cached and optionally, by specifying an integer value, for how many seconds.
Output
object|null
An instance of the requested class, or null if it could not be instantiated.
Details
visibility
public
final
false
static
true

loadCollection

loadCollection( \xPDO $xpdo, string $className, mixed $criteria = null, boolean|integer $cacheFlag = true ) : array

Custom collection loader that forces access policy checking.

{@inheritdoc}

Arguments
$xpdo
\xPDO
&$xpdo A valid xPDO instance.
$className
string
Name of the class.
$criteria
mixed
A valid primary key, criteria array, or xPDOCriteria instance.
$cacheFlag
booleaninteger
Indicates if the objects should be cached and optionally, by specifying an integer value, for how many seconds.
Output
array
An array of xPDOObject instances or an empty array if no instances are loaded.
Details
visibility
public
final
false
static
true

remove

remove( array $ancestors = array ) : boolean

Custom remove that respects access policies.

{@inheritdoc}

Arguments
$ancestors
array
Keeps track of classes which have already been removed to prevent loop with circular references.
Output
boolean
Returns true on success, false on failure.
Details
visibility
public
final
false
static
false

save

save( boolean|integer $cacheFlag = null ) : boolean

Custom save that respects access policies.

{@inheritdoc}

Arguments
$cacheFlag
booleaninteger
Indicates if the saved object(s) should be cached and optionally, by specifying an integer value, for how many seconds before expiring. Overrides the cacheFlag for the object(s).
Output
boolean
Returns true on success, false on failure.
Details
visibility
public
final
false
static
false

setPolicies

setPolicies(  $policies = array ) :
Arguments
$policies
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox 0.11.2.