Type
This interface represent the Limitation Type.
A Limitation is a lot like a Symfony voter, telling the permission system if user has access or not. It consists of a Limitation Value which is persisted, and this Limitation Type which contains the business logic for evaluate ("vote"), as well as accepting and validating the Value object and to generate criteria for content/location searches.
Constants¶
ACCESS_ABSTAIN ¶
The type abstains from voting.
|
|
Constant for return value of Type::evaluate().
Returning ACCESS_ABSTAIN must mean that evaluate does not support the provided $object or $targets, this is 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.
ACCESS_DENIED ¶
Access is denied.
|
|
Constant for return value of Type::evaluate().
Note: In future version constant values might change to 1, 0 and -1 as used in Symfony.
ACCESS_GRANTED ¶
Access is granted.
|
|
Constant for return value of Type::evaluate().
Note: In future version constant values might change to 1, 0 and -1 as used in Symfony.
VALUE_SCHEMA_LOCATION_ID ¶
Limitation's value must be an array of location IDs.
|
|
Constant for Type::valueSchema() return values.
GUI should typically present option to browse content tree to select limitation value(s).
VALUE_SCHEMA_LOCATION_PATH ¶
Limitation's value must be an array of location paths.
|
|
Constant for Type::valueSchema() return values.
GUI should typically present option to browse content tree to select limitation value(s).
Methods¶
acceptValue()
¶
Accepts a Limitation value and checks for structural validity.
|
|
Makes sure LimitationValue object and ->limitationValues is of correct type.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$limitationValue | Limitation | - | - |
Tags
buildValue()
¶
Create the Limitation Value.
|
|
This 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<int, mixed> | - | - |
Return values
evaluate()
¶
Evaluate ("Vote") against a main value object and targets for the context.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$value | Limitation | - | - |
$currentUser | UserReference | - | - |
$object | ValueObject | - | - |
$targets | array<int, ValueObject>|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, Type::ACCESS_GRANTED, Type::ACCESS_ABSTAIN, or Type::ACCESS_DENIED.
Tags
getCriterion()
¶
Returns Criterion for use in find() query.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$value | Limitation | - | - |
$currentUser | UserReference | - | - |
Return values
CriterionInterface|LogicalOperator
Tags
validate()
¶
Makes sure LimitationValue->limitationValues is valid according to valueSchema().
|
|
Make sure Type::acceptValue() is checked first.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$limitationValue | Limitation | - | - |
Return values
array<int, ValidationError>
valueSchema()
¶
Returns info on valid $limitationValues.
|
|
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.