type

FieldAccessRule

type FieldAccessRule func(FieldAccessContext) (bool, error)

Authorize one field operation; false rejects writes or redacts reads.

Source core/access.go:54

@param ctx
The field occurrence and surrounding operation state.
@returns
Whether the field is allowed, or an evaluation error.

Example

go
func editorsOnly(ctx ridu.FieldAccessContext) (bool, error) {
  return actorHasRole(ctx.Actor, "editor"), nil
}

Related types

  • FieldAccessContext

    The concrete field occurrence and transaction state supplied to a field rule.