Copied!

TargetAwareType

TargetAwareType.php : 22
Extends Type

Represents Limitation type.

Indicates that Limitation Type implementation properly supports $targets passed as instances of Target.

Tags
See
Type
See
Target

Constants

publicACCESS_ABSTAIN

Type.php : 34
public mixed ACCESS_ABSTAIN = null

publicACCESS_DENIED

Type.php : 35
public mixed ACCESS_DENIED = false

publicACCESS_GRANTED

Type.php : 33

Constants for return value of {@see evaluate()}.

public mixed ACCESS_GRANTED = true

Currently ACCESS_ABSTAIN must mean that evaluate does not support the provided $object or $targets, this is currently only supported by role limitations as policy limitations should not allow this.

Note: In future version constant values might change to 1, 0 and -1 as used in Symfony.

publicVALUE_SCHEMA_LOCATION_ID

Type.php : 43

Constants for valueSchema() return values.

public mixed VALUE_SCHEMA_LOCATION_ID = 1

Used in cases where a certain value is accepted but the options are to many to return as a hash of options. GUI should typically present option to browse content tree to select limitation value(s).

publicVALUE_SCHEMA_LOCATION_PATH

Type.php : 44
public mixed VALUE_SCHEMA_LOCATION_PATH = 2

Methods

publicacceptValue()

Type.php : 55

Accepts a Limitation value and checks for structural validity.

public acceptValue(Limitation $limitationValue) : mixed

Makes sure LimitationValue object and ->limitationValues is of correct type.

Parameters

Name Type Default value Description
$limitationValue Limitation - -
Tags
Throws
InvalidArgumentException

If the value does not match the expected type/structure

publicbuildValue()

Type.php : 78

Create the Limitation Value.

public buildValue(array<string|int, mixed> $limitationValues) : Limitation

The is the method to create values as Limitation type needs value knowledge anyway in acceptValue, the reverse relation is provided by means of identifier lookup (Value has identifier, and so does RoleService).

Parameters

Name Type Default value Description
$limitationValues array<string|int, mixed> - -

Return values

Limitation

publicevaluate()

TargetAwareType.php : 38

Evaluate ("Vote") against a main value object and targets for the context.

public evaluate(Limitation $value, UserReference $currentUser, ValueObject $object[, array<string|int, Target>|null $targets = null ]) : bool|null

Parameters

Name Type Default value Description
$value Limitation - -
$currentUser UserReference - -
$object ValueObject - -
$targets array<string|int, Target>|null null

An array of location, parent or "assignment" objects, if null: none where provided by caller

Return values

bool|null

Returns one of ACCESS_* constants

Tags
Throws
BadStateException

If value of the LimitationValue is unsupported

Throws
InvalidArgumentException

If any of the arguments are invalid

publicgetCriterion()

Type.php : 110

Returns Criterion for use in find() query.

public getCriterion(Limitation $value, UserReference $currentUser) : CriterionInterface|LogicalOperator

Parameters

Name Type Default value Description
$value Limitation - -
$currentUser UserReference - -

Return values

CriterionInterface|LogicalOperator

Tags
Throws
NotImplementedException

If the limitation does not support being used as a Criterion.

publicvalidate()

Type.php : 66

Makes sure LimitationValue->limitationValues is valid according to valueSchema().

public validate(Limitation $limitationValue) : array<string|int, ValidationError>

Make sure Type::acceptValue() is checked first.

Parameters

Name Type Default value Description
$limitationValue Limitation - -

Return values

array<string|int, ValidationError>

publicvalueSchema()

Type.php : 119

Returns info on valid $limitationValues.

public valueSchema() : array<string|int, mixed>|int

Return values

array<string|int, mixed>|int

In case of array, a hash with key as valid limitations value and value as human readable name of that option, in case of int on of VALUE_SCHEMA_* constants. Note: The hash might be an instance of Traversable, and not a native php array.