Class LaravelUi5\Sdk\Partners\Attributes\ScopedByRole

final
readonly

Declares row-level visibility for an OData entity set: rows are visible if the current actor holds {@see $role} on the row's target context, via sdk_role_assignments.

Convention. The source query returned by baseQuery() must expose a "{contextType}_id" column holding the row's target id. For contextType: 'partner' that's partner_id; for contextType: 'territory', territory_id. (Laravel's morph-key convention.)

Example.

#[ScopedByRole('key_account', 'partner')]
final readonly class ProspectsEntitySet extends ScopedAbstractEntitySet
{
    protected function baseQuery(): Builder
    {
        return DB::table('prospects_view');   // exposes `partner_id`
    }
}

Read by {@see \LaravelUi5\Sdk\Odata\ScopedAbstractEntitySet}; one declaration per entity set or none. See https://laravelui5.com/sdk/security/scoped-entity-sets for the consumer recipe and the design rationale.

Methods
Properties