Skip to content

angee.graphql.relations

Guard-aware relation fields for Strawberry-Django schemas.

actor_scoped_to_one

python
def actor_scoped_to_one(field_name: str) -> Any

Return a nullable to-one field that redacts targets unreadable by the actor.

The parent may be actor-scoped or sudo-loaded: a cached related object is used only when REBAC stamped it for the current actor; otherwise the stored FK value is re-gated through the target model's actor-scoped manager. Missing access returns None rather than raising. Strawberry-Django's native prefetch hint batches a selected relation once per parent list, while only keeps the parent projection to the FK id this resolver reads.

actor_scoped_to_many

python
def actor_scoped_to_many(field_name: str) -> Any

Return a to-many field whose rows are scoped to the current actor.

The parent may be actor-scoped through one relation while the selected to-many relation contains other protected rows. Resolve the relation through the target model's actor-scoped queryset instead of exposing the raw related manager.

Released under the AGPL-3.0 License.