Interface LaravelUi5\Sdk\Intent\Contracts\IntentAuthorizerInterface

Authorizes intents for both presentation and execution.


Mental model

Intent authorization is a continuous filter, not a single checkpoint.

The same authorization rules apply in two distinct phases:

  1. Discovery / Presentation

    • Which intents may be shown to the user?
    • Used by CmdK, navigation, and shell components.
  2. Invocation / Execution

    • May the selected intent actually be executed now?
    • Enforced by the IntentDispatcher.

This interface intentionally unifies both concerns to ensure:

  • a single source of truth
  • consistent behavior across UI and backend
  • no divergence between "visible" and "executable"

Design principles

  • Authorization logic is intent-centric, not UI-centric.
  • The same rules MUST apply for filtering and execution.
  • Absence of authorization is never implicit: every intent is subject to authorization.
  • "Open access" must be expressed explicitly by the authorizer.

Typical usage

  • CmdK / Navigation: -> authorize() decides whether a discovered intent may be offered.

  • IntentDispatcher: -> authorize() is called for the selected intent before handling.

One method answers both phases, by design: what is offered and what may run cannot then diverge. (A list-level filter() was considered and not built — callers filter with authorize().)


Example

final class OpenReportIntentAuthorizer implements IntentAuthorizerInterface { public function authorize( IntentInterface $intent, SdkContext $context ): bool { return $context->user()->can('viewReports'); } }
  • LaravelUi5\Sdk\Intent\Contracts\IntentAuthorizerInterface
    • LaravelUi5\Sdk\Intent\Ui5ValueHelpOpenIntentAuthorizer implements IntentAuthorizerInterface
    • LaravelUi5\Sdk\Intent\SessionLogoutIntentAuthorizer implements IntentAuthorizerInterface
    • LaravelUi5\Sdk\Intent\NavigationIntentAuthorizer implements IntentAuthorizerInterface
    • LaravelUi5\Sdk\Intent\Ui5ArtifactOpenIntentAuthorizer implements IntentAuthorizerInterface
    • LaravelUi5\Sdk\Impersonation\ImpersonateIntentAuthorizer implements IntentAuthorizerInterface
    • LaravelUi5\Sdk\Intent\WeaveAuthorizer implements IntentAuthorizerInterface
    • LaravelUi5\Sdk\Intent\WeaveOpenAuthorizer implements IntentAuthorizerInterface
    • LaravelUi5\Sdk\Shell\CmdK\AllowAllIntentsAuthorizer implements IntentAuthorizerInterface
Methods