Developer Plugin Runtime and Authorization
An App has several independent contexts: reusable source and releases, a project installation, a portal binding, a request principal and the resources that request may access. Dependencies participate in authorization; they do not replace portal access checks, attendee identity, project constraints, group rules or endpoint-specific validation.
For authoring and release mechanics, use Plugin Architecture, Development Overview and Variants and Releases. This guide follows the installed runtime and shared API authorization paths.
Objects and effective version
| Object | Responsibility |
|---|---|
PluginPage | Team-owned reusable App definition |
PluginPageVariant | Branch/release track and default version selection |
PluginPageVersion | Runtime files, settings schema, manifest and dependency declarations for a draft or release |
ProjectPage | Project installation: selected version, custom_settings, dependency_list, style/language overrides |
ProjectPortalPage | Portal URL, content reference, active/login/audience context and page API key |
ProjectPortalPage::projectPage() and model() are polymorphic accessors over the same model_type/model_id pair; portal content can also be a form. Do not assume every link points to a ProjectPage.
ProjectPage::version() resolves its explicit plugin_page_version_id relationship, but falls back to the plugin's currentVersion when that relationship does not resolve. An absent, zero or stale reference therefore does not establish a fixed release. Inspect both installed IDs and the effective version at runtime. Defaults can affect unpinned consumers; publication does not automatically upgrade every explicit selection. A page key identifies the portal binding, not an immutable copy of its dependencies.
Define capabilities and resolve bindings
Choose supported models, actions and events from the current Developer Hub catalog. The catalog uses permission keys such as view_attendees; do not invent Attendee:view or attendee.updated names from a model/method convention.
The following exact declaration also appears in the Permissions and Dependencies guide:
[
{
"model": "Attendee",
"identifiers": ["attendee_profile"],
"permissions": ["view_attendees"],
"events": {"profileUpdated": "AttendeeUpdated"},
"visibleFields": []
}
]
The declaration names the attendee_profile slot. A configuration dependency selector must use that same name so installation configuration can store its selected value under ProjectPage.dependency_list. The declaration alone does not select an attendee. Use the declared key when present; the shared resolver otherwise uses the model route key.
| Field | Contract |
|---|---|
model | Catalog model name |
identifiers | Current builder's list of any-of scope tokens |
identifier | Older singular shape still accepted by the shared resolver; when both shapes exist, it takes precedence |
key | Column used to match bound values |
permissionKey | Stable address for a capability slot and parent references; otherwise the resolver falls back to identifier/first identifier |
parentRelation | Optional explicit child-to-parent relationship for parent scope |
permissions | Supported action keys, with normalized compatibility suffixes where applicable |
events | Local event alias mapped to the catalog's broadcast event |
visibleFields | Developer field selection where supported; empty does not mean redact everything |
The bundle processor's normalizeDependencyPermissions preserves string actions and accepts object entries containing permission; an object with action: viewAny also adds <permission>:viewAny. This is different from the old pseudo-format Model:ability. Inspect saved normalized declarations when diagnosing broad access.
Scope tokens
- A binding key such as
attendee_profilelooks up that key independency_list. *selects all objects within the surrounding request/project context, not another project's data.#<tag ID>or supported tag slug bindings select tagged resources;@untaggedselects untagged resources.@<permissionKey>references another dependency's scope through a supported child-to-parent relationship.
Multiple tokens are alternatives. Array-valued bindings, tags and parent scopes use resolver behavior beyond a single scalar equality check. Missing/unresolvable scopes fail closed in the shared query resolver; a parent reference requires a resolvable parent dependency and relation. A parent-scoped child action can also authorize relation routes against the bound parent, and a supported parent dependency can authorize its child resources through a resolved relation. These are explicit shared-model/resolver paths, not a claim that every arbitrary relationship grants access.
The detailed parent declaration, exact binding and editor round-trip limits are in Permissions and Dependencies. Keep parent metadata intact when saving advanced definitions; a visual editor is not proof that every advanced field survives unchanged.
Authorization is more than one boolean
The shared paths perform related but different work:
- Resolve the requested portal/project and page context.
- Identify the attendee, reader, admin or API-token principal appropriate to the endpoint.
- Enforce page active/login/audience access when a page key is used.
- Evaluate the requested action through the endpoint policy and dependency context.
- Constrain queries and fields using the effective permission plan where the endpoint consumes it.
- Validate and serialize the endpoint-specific operation.
A successful authorizeApi result is not a substitute for checking the query and response. Domain resolution alone is not tenant authorization, and a hidden navigation item is not a direct API denial.
Shared page model checks
ProjectPortalPage::authorizeApi reads the effective linked version's dependencies and the installation's binding list. Empty dependencies return false. It tries matching model declarations independently, so one failed slot does not prevent another matching slot from granting access.
For ordinary slots, the scalar compatibility helper considers exact action matches, wildcard bindings, specific existing-record matches and collection/new-model checks. It also recognizes special broad strings such as <ability>:viewAny and <ability>:updateAny. Array/tag bindings can then be evaluated through DependencyScopeResolver for existing records. Parent-scoped slots take their dedicated path and do not fall through to the ordinary project-wide scalar check.
Do not read viewAny in a controller method name as a universal bypass, or assume a named binding always narrows a broad declaration. In the reviewed permission-plan compiler, non-parent-scoped :viewAny can widen a slot, while parent-scoped slots retain their structural parent restriction. Verify the requested catalog ability, stored normalized permissions and effective query scope together. Collection authorization, existing-record authorization and create validation are different contracts.
For example, a named attendee slot bound to one selected record is intended to narrow reads to that record. A list request can pass a collection-level action check before any attendee model exists; the query must still apply the intended scope. If a non-parent-scoped normalized <ability>:viewAny contribution makes the effective plan project-wide, the list can include other records despite the named binding. Compare the list with a direct request for an excluded record and inspect returned fields; never resolve a blank list by adding a broad ability without reviewing that change.
Group permissions and visible fields
Audience rules can be inherited from the linked page or overridden on a portal link. Matching deny rules affect the page gate; matching allow contributions combine permissions and scopes permissively. Adding a restrictive allow rule does not cancel a broader matching allow contribution.
Field lists also require care: an empty developer selection is unrestricted by that selection; an empty rule field list inherits it. An explicit rule field list can replace and widen that contribution's developer selection, and matching allows union their contributions. Check actual endpoint serialization and sensitive-field behavior. See Group Permissions for implementation details and verification cases.
Page keys and request principals
ProjectPortalPage creates its key through its own created model callback calling setApiKey(). That method calls Sanctum createToken(url_slug), stores the returned plain-text token in plain_text_key, and saves. The HasApiTokens trait supplies token operations; it does not itself automatically provision this application-specific key.
ProjectPortalWidget has its own creation callback and token naming logic. Its widget-<id>-<random> string is the token name supplied to Sanctum, not the literal wire format of the returned bearer credential. Widgets have separate installed configuration and security behavior; do not assume their endpoints reuse every page authorization path.
The portal toolkit carries page context in X-Portal-Page-Token along with the appropriate attendee/session credentials. Legacy page-key bearer transport also exists. Use supported store API helpers instead of replacing attendee identity with a page token. Management keys, project API keys, reader credentials and page keys have different authorization branches.
Page access refusals
PortalPageAccess is shared by permission-context enforcement and the base policy's page branch:
| Condition | Shared refusal behavior |
|---|---|
| Page inactive | 404 |
| Login required, no qualifying same-project principal | 401 |
| Audience/group gate denies | 404 |
| Attendee belongs to another project | Does not count as the page's login principal |
| Reader inactive or belongs to another project | Does not count as the page's login principal |
An active same-project reader can satisfy this shared login gate, but is evaluated as a guest for the attendee group gate. That is not attendee identity and does not make reader credentials valid for every attendee endpoint. Review the endpoint's attendee requirement and reader allowlist before designing a reader-based flow.
PortalPageTokenResolver validates page-token syntax and resolves either header or bearer page credentials. Callers apply ownership checks. The shared resolver itself does not check token expiry; Sanctum-guarded routes enforce expiry separately, so do not assume an unguarded caller has the same contract. Page tokens are normally minted without an explicit expiry.
PortalApiConfig marks portal_page_rejected on the current request when a resolved key belongs to another portal; this is a request attribute, not a persistent token blacklist or cooldown. EnforcePermissionContext rejects that refused page key, a bearer page key that does not match the bound page, page-access refusals and a denied permission verdict. The base policy also rejects page/project mismatches. These shared checks do not prove every custom route uses the same middleware or policy.
Credential handling
A page key can appear in the browser because it identifies the installed runtime context. Treat its permitted capabilities as public exposure to be tested, rather than assuming nobody can copy the key. Avoid broad dependencies and verify login/audience protection with direct API requests.
Do not describe tokens as non-transferable or permanently version-locked. Copying a key identifies its owner context; it does not acquire the destination page's permissions. Changes to the installed effective version, bindings or rules can change the result. For a compromised project API key, follow the issuance/revocation procedure in API Keys, confirm the old credential fails and verify dependent integrations. Page keys have a different lifecycle: setApiKey() creates another token and saves its value; that method does not itself delete existing tokens. Do not assume calling it revokes an older key. Have an authorized platform maintainer confirm and revoke the affected page credential through the applicable platform controls, then test old-key denial. This guide does not establish a self-service page-token rotation control. Deleting a page is not evidence that every related stored credential or cache has been revoked.
Project-token ownership is a separate boundary: the API Keys guide records synthetic-test limitations in row/field enforcement and cross-project checks for model-wide abilities. Do not infer verified isolation from a token’s owning project alone; verify the actual endpoint. Project API-key scope syntax and lifecycle are documented in API Keys. Plugin management tokens are limited to supported plugin endpoints; they are not general project data credentials.
Descriptor props versus rendered values
PluginProps::getPluginProps() produces descriptor metadata for dependencies, configuration, strings, assets and permission flags. For example, a configuration descriptor can have key, label and default; it is not itself the final app configuration. processDependencies expands event aliases for singular or plural identifiers into socket-listener descriptors. proccessNavigationFlags expands the version's navigation-option metadata, rather than evaluating the portal link's audience rules.
getDefaultPropValues() starts from app-manifest settings and default strings, then processes the settings schema's defaults. The actual Services/Portal/PluginPageRenderService obtains the effective version, shallow-merges default configuration with installation custom_settings, and adds runtime values including projectId, apiPageAuthId, apiBaseUrl and injectDataStore. Form links add their form schema/registration values through their separate branch.
The render service also shallow-merges language defaults/overrides, resolves asset URLs, passes portal permission flags and resolved navigation configuration, and prepares the permission payload. Nested objects are not recursively merged by those array_merge calls. Styles are not a universal merge either: when version style exists and the installation has no override, the renderer assigns that style to the in-memory override value.
For an unpublished version with a variant and eligible active development session, the renderer can replace bundled URLs with the session's /src/Plugin.vue preview and omit the compiled style URL. A working draft preview therefore does not prove the published artifact or installed production configuration is correct.
Diagnose failures by boundary
| Symptom | Inspect |
|---|---|
| Page loads, API denies | Principal, page header/bearer consistency, effective version, catalog action, binding and endpoint policy |
Login-only page returns 401 | Same-project attendee/active reader context; the page key alone does not log in a person |
| Restricted page looks missing | Active state, audience/group gate and mismatched portal/project/page context |
| Selected slot returns too much | Wildcard, normalized broad suffix, overlapping allows, effective query plan and endpoint scoping |
| Selected slot returns nothing | Exact selector key, declared route-key column, saved binding, parent relation and advanced metadata preservation |
| New defaults change a project unexpectedly | Missing/stale explicit version relationship or intentional unpinned selection |
| Field restriction seems ineffective | Empty-list semantics, wider matching rule, serializer and endpoint plan consumption |
| Configuration loses nested values | Shallow default/installation merge; supply the complete intended nested object |
| Preview works but released app fails | Built commit/artifact, selected release, compiled assets and missing development-session overlay |
Verify the installed integration
Record team/project, portal URL, explicit and effective version IDs, bindings and expected principal categories. Test guest, attendee, active/inactive reader where supported, overlapping groups, inactive/login-only pages, header/bearer mismatches, cross-project IDs, selected/tagged/parent scopes, denied actions and response fields. Test direct API calls as well as navigation, and repeat after release/default/rule changes. Keep credentials out of acceptance evidence. Use the Project Acceptance evidence format: exact environment and resource, test identity category, expected and observed outcome, resolved version, and reproducible sanitized report. For a selected-record scenario, define expected included/excluded IDs and visible fields before testing; denied cross-project/actions must not produce a successful response with protected data. Exact routes and successful response schemas come from each endpoint’s API reference, rather than a generic /api/v1/attendees example.
Plans and templates can generate project resources, but do not promise that every new project has a default portal: it must be included by the selected plan/configuration. Use Experience Plans for the actual template structure rather than the prior illustrative objects/resolve: current_attendee JSON.
Source and retained evidence
Primary implementation paths: ProjectPage, ProjectPortalPage, ProjectPortalWidget, PluginProps, Services/Portal/PluginPageRenderService, DependencyScopeResolver, PortalPageAccess, PortalPageTokenResolver, permission-context middleware and BaseDashboardPolicy. The catalog and bundle normalizer define action/event spellings and saved permission normalization.
Retained source snapshot and review report distinguish source/example checks from deployed endpoint and authorization acceptance. The previous catalogue remains in repository design history.