ReceiverAwareInterface
in
Entity that knows who received it (the receiver of the record); the basis of the conditional RBAC role `receiver`.
The default receiver check in the Api presenter (ApiPermissionGuardTrait::isReceiver() internally,
RbacCheckTrait::verifyReceiver() externally) is fail-closed: it lets the caller in only when the entity
implements this interface and getReceiverUserId() returns the id of the logged-in user.
A domain with a direct receiver column (e.g. a private message) enables the role by implementing this method
on the entity and granting receiver on the key, with no presenter code. A presenter may extend the base
with its own branches (see Api ResponsePresenter).
IMPORTANT: the receiver is not the author or sender (that is the owner role); mixing them up lets the
wrong person pass the check. null means the receiver cannot be determined reliably from the entity
(anonymous receiver, association not loaded), and the check then returns false. The method must not
trigger lazy loading or a database query.
Table of Contents
Methods
- getReceiverUserId() : int|null
- Returns the id of the user who received the record; `null` for an unknown or anonymous receiver.
Methods
getReceiverUserId()
Returns the id of the user who received the record; `null` for an unknown or anonymous receiver.
public
getReceiverUserId() : int|null