Skip to content

angee.iam.audit

Reusable GraphQL projection of audit user-references.

AuditMixin (angee.base.mixins) stamps created_by / updated_by foreign keys on a row. Every audited GraphQL type needs the same projection of those keys: the actor's public id plus a display label, resolved without exposing the guarded user object — the id goes through IAM's user_public_id and the label through user_display_label, both of which read under IAM's elevation and let only the scalar leave. This mixin owns that projection once so audited types compose it instead of re-declaring the four resolvers.

It is a @strawberry.type (not an interface): a type composed alongside the node base (class FooType(AuthoredRefMixin, AngeeNode)) merges these fields into the concrete type without surfacing an extra GraphQL interface in the SDL.

AuthoredRefMixin

python
@strawberry.type
class AuthoredRefMixin()

Project AuditMixin user references as {id, label} for a GraphQL type.

Compose alongside the node base, e.g. class PageType(AuthoredRefMixin, AngeeNode). The only=[...] hints keep each resolver to the single id column it reads.

created_by

python
@strawberry_django.field(only=["created_by_id"])
def created_by() -> strawberry.ID | None

Return the creator's public id without exposing the user object.

created_by_label

python
@strawberry_django.field(only=["created_by_id"])
def created_by_label(info: strawberry.Info) -> str | None

Return the creator's display label - no user object exposed.

updated_by

python
@strawberry_django.field(only=["updated_by_id"])
def updated_by() -> strawberry.ID | None

Return the last editor's public id without exposing the user object.

updated_by_label

python
@strawberry_django.field(only=["updated_by_id"])
def updated_by_label(info: strawberry.Info) -> str | None

Return the last editor's display label - no user object exposed.

Released under the AGPL-3.0 License.