RestrictInteractionEvent
extends Event
in package
This event can be emitted to check if a user is allowed to perform an action, such that the receiver would become aware of the resource.
If the resource has a distinction between an owner and a initiator, the event must be emitted for both. Emitters may omit one or multiple properties, if they are not known. Emitters must call isInteractionRestricted instead of dispatching the event manually, to ensure exception handling and audit logging is done correctly. Listeners may ignore any of the properties and only check the ones that are relevant to them. Listeners must throw an InteractionRestrictedException, if they want to restrict the interaction.
Tags
Attributes
- #[Consumable]
- $since: '34.0.2'
Table of Contents
Properties
- $action : InteractionAction|null
- $receiver : InteractionReceiver|null
- $resource : InteractionResource|null
- $userId : string
- $user : IUser|null
Methods
- __construct() : mixed
- Compatibility constructor
- getUser() : IUser
- isInteractionRestricted() : false|string
- isPropagationStopped() : bool
- {@inheritDoc}
- stopPropagation() : void
- Stops the propagation of the event to further event listeners
Properties
$action read-only
public
InteractionAction|null
$action
$receiver read-only
public
InteractionReceiver|null
$receiver
$resource read-only
public
InteractionResource|null
$resource
$userId read-only
public
string
$userId
$user
private
IUser|null
$user
Methods
__construct()
Compatibility constructor
public
__construct(string $userId, IUser|null $user, InteractionResource|null $resource, InteractionAction|null $action, InteractionReceiver|null $receiver) : mixed
Parameters
- $userId : string
- $user : IUser|null
- $resource : InteractionResource|null
- $action : InteractionAction|null
- $receiver : InteractionReceiver|null
Tags
getUser()
public
getUser() : IUser
Tags
Return values
IUserisInteractionRestricted()
public
isInteractionRestricted() : false|string
Tags
Return values
false|string —Returns a user friendly translated message if the interaction is restricted.
isPropagationStopped()
{@inheritDoc}
public
isPropagationStopped() : bool
Tags
Attributes
- #[Override]
Return values
boolstopPropagation()
Stops the propagation of the event to further event listeners
public
stopPropagation() : void