Class LaravelUi5\Sdk\Partners\Attributes\ScopedToOrgActors

final
readonly
implements PartnerScopeAttributeInterface

Declares row-level visibility for an OData entity set as org-actor-bridged: rows are visible when the keying column matches one of the organization partner_ids the current actor is a primary employee of, as of the request time. Backed by {@see OrgPartnerResolver}.

Use this when the entity is owned by a company partner but the portal's actor is a person — the resolver walks actor → sdk_partner_relationships (employed_by, is_primary, active) → org and returns the org partner_ids the row's keying column is matched against. Reads as "rows scoped to the org's actors" — i.e. the people currently acting on behalf of that org.

Convention. The source query returned by baseQuery() must expose the column named by {@see $keyColumn} (defaults to partner_id, which on org-keyed tables points at the organization partner).

Example. M5's customer-portal license entity set, keyed on the organization partner that owns the entitlement:

#[ScopedToOrgActors]
final readonly class MyLicenseEntitySet extends ScopedAbstractEntitySet
{
    protected function baseQuery(): Builder
    {
        return DB::table('sdk_licenses')
            ->whereNull('terminated_at')
            ->where('valid_from', '<=', now())
            ->where('valid_until', '>=', now())
            ->orderByDesc('valid_from')
            ->limit(1);
    }
}

Read by {@see \LaravelUi5\Sdk\Odata\ScopedAbstractEntitySet}; one scope-attribute declaration per entity set. See https://laravelui5.com/sdk/security/scoped-entity-sets for the design rationale and the resolver family this attribute is part of.

Methods