| Methods |
public
|
impersonableTargetsFor(Partner $principal, Carbon $at): Partner[]
The partners $principal may act as at $at — the impersonable set. Empty
when the principal holds no active delegation.
The partners $principal may act as at $at — the impersonable set. Empty
when the principal holds no active delegation.
Implemented by
|
#
|
public
|
canImpersonate(Partner $principal, int $targetPartnerId, Carbon $at): bool
Whether $principal holds an active delegation for $targetPartnerId at $at.
Whether $principal holds an active delegation for $targetPartnerId at $at.
Implemented by
|
#
|
public
|
begin(Partner $principal, int $targetPartnerId, Carbon $at): void
Enter impersonation: validate $targetPartnerId against $principal's active
delegations, then write the session key.…
Enter impersonation: validate $targetPartnerId against $principal's active
delegations, then write the session key. Throws
{@see \LaravelUi5\Sdk\Impersonation\Exceptions\ImpersonationDeniedException}
when the principal may not impersonate the target.
Implemented by
|
#
|
public
|
end(): void
Leave impersonation: clear the session key. Idempotent (a no-op when not
impersonating).
Leave impersonation: clear the session key. Idempotent (a no-op when not
impersonating).
Implemented by
|
#
|
public
|
grant(
int $delegatePartnerId,
int $targetPartnerId,
Carbon $validFrom,
Carbon $validUntil,
int $grantedBy,
?string $note = null,
): Delegation
Issue a new delegation (grant B the right to impersonate A). Rejects
self-delegation and any overlap with an existing…
Issue a new delegation (grant B the right to impersonate A). Rejects
self-delegation and any overlap with an existing active window for the same
(delegate, target) pair. The SystemLevel gate is the caller's (D3).
Implemented by
|
#
|
public
|
delineate(Delegation $delegation, Carbon $validUntil): Delegation
Delineate a delegation — shorten its `valid_until` to end it early. Never
deletes; `valid_from` is immutable.
Delineate a delegation — shorten its valid_until to end it early. Never
deletes; valid_from is immutable.
Implemented by
|
#
|
public
|
cancel(Delegation $delegation): void
Cancel a delegation that never took effect — hard-delete it. Only legitimate
for a **future** (not-yet-started) grant:…
Cancel a delegation that never took effect — hard-delete it. Only legitimate
for a future (not-yet-started) grant: it never opened an impersonation
window, so there is nothing to audit and no reason to keep the row. Ending an
active delegation must go through {@see delineate()} instead (that window
existed and is retained). Throws
{@see \LaravelUi5\Sdk\Impersonation\Exceptions\ImpersonationDeniedException}
when the delegation has already started.
Implemented by
|
#
|