type
AccessContext
Actor, target, locale, data, and nested API supplied to an access rule.
Example
func ownerOnly(ctx ridu.AccessContext) (ridu.AccessDecision, error) {
if ctx.Actor == nil {
return ridu.Deny(), nil
}
return ridu.Where(query.Equal("author", ctx.Actor.ID)), nil
}Properties
| Property | Type | Description |
|---|---|---|
Context | context.Context | Request cancellation and deadline context. |
Operation | operation.Kind | The operation being authorized. |
CollectionID | schema.StableID | Target collection identity. |
GlobalID | schema.StableID | Target global identity, when applicable. |
ID | string | Current document ID; empty for create and list. |
Actor | *store.Document | Authenticated actor, or nil. |
ActorCollection | schema.CollectionSlug | The exact auth collection that owns Actor. |
Data | store.Values | Detached incoming values for writes. |
Local | *LocalAPI | Nested operations in the active transaction. |
Locale | schema.LocaleCode | Selected locale. |
AllLocales | bool | Whether every locale is selected. |
How it works
Use the root alias in application configuration.