class ReadNotificationHandler

Traits

Methods

assertPermission(bool $condition)

Ensure the current user is allowed to do something.

assertRegistered(User $actor)

Ensure the given actor is authenticated.

assertCan(User $actor, string $ability, mixed $arguments = [])

No description

assertAdmin(User $actor)

No description

handle(ReadNotification $command)

No description

Details

protected assertPermission(bool $condition)

Ensure the current user is allowed to do something.

If the condition is not met, an exception will be thrown that signals the lack of permissions. This is about <em>authorization</em>, i.e. retrying such a request / operation without a change in permissions (or using another user account) is pointless.

Parameters

bool $condition

Exceptions

PermissionDeniedException

protected assertRegistered(User $actor)

Ensure the given actor is authenticated.

This will throw an exception for guest users, signaling that <em>authorization</em> failed. Thus, they could retry the operation after logging in (or using other means of authentication).

Parameters

User $actor

Exceptions

NotAuthenticatedException

protected assertCan(User $actor, string $ability, mixed $arguments = [])

Parameters

User $actor
string $ability
mixed $arguments

Exceptions

PermissionDeniedException

protected assertAdmin(User $actor)

Parameters

User $actor

Exceptions

PermissionDeniedException

Notification handle(ReadNotification $command)

Parameters

ReadNotification $command

Return Value

Notification

Exceptions

PermissionDeniedException