AccessResultReasonInterface
interface AccessResultReasonInterface implements AccessResultInterface (View source)
Interface for access result value objects with stored reason for developers.
For example, a developer can specify the reason for forbidden access:
Methods
Checks whether this access result indicates access is explicitly allowed.
Checks whether this access result indicates access is explicitly forbidden.
Checks whether this access result indicates access is not yet determined.
Gets the reason for this access result.
Sets the reason for this access result.
Details
bool
isAllowed()
Checks whether this access result indicates access is explicitly allowed.
bool
isForbidden()
Checks whether this access result indicates access is explicitly forbidden.
This is a kill switch — both orIf() and andIf() will result in isForbidden() if either results are isForbidden().
bool
isNeutral()
Checks whether this access result indicates access is not yet determined.
AccessResultInterface
orIf(AccessResultInterface $other)
Combine this access result with another using OR.
When ORing two access results, the result is:
- isForbidden() in either ⇒ isForbidden()
- otherwise if isAllowed() in either ⇒ isAllowed()
- otherwise both must be isNeutral() ⇒ isNeutral()
Truth table:
AccessResultInterface
andIf(AccessResultInterface $other)
Combine this access result with another using AND.
When ANDing two access results, the result is:
- isForbidden() in either ⇒ isForbidden()
- otherwise, if isAllowed() in both ⇒ isAllowed()
- otherwise, one of them is isNeutral() ⇒ isNeutral()
Truth table:
string
getReason()
Gets the reason for this access result.
AccessResultInterface
setReason($reason)
Sets the reason for this access result.