RestrictInteractionEvent
extends Event
in package
This event can be emitted to check if a user is allowed to perform an action, such that the receivers would become aware of the resources.
If the resources have a distinction between an owner and a initiator, the event must be emitted for each separately. 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
- $receivers : array<int, InteractionReceiver>
- $resources : array<int, InteractionResource>
- $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
$receivers read-only
public
array<int, InteractionReceiver>
$receivers
$resources read-only
public
array<int, InteractionResource>
$resources
$userId read-only
public
string
$userId
$user
private
IUser|null
$user
Methods
__construct()
Compatibility constructor
public
__construct(string $userId, IUser|null $user, array<string|int, mixed> $resources, InteractionAction|null $action, array<string|int, mixed> $receivers) : mixed
Parameters
- $userId : string
- $user : IUser|null
- $resources : array<string|int, mixed>
- $action : InteractionAction|null
- $receivers : array<string|int, mixed>
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