type
CollectionAccess
Access rules for collection reads and mutations.
Example
var Posts = ridu.Collection{
Access: ridu.CollectionAccess{
Create: authenticated,
Read: publishedOrOwner,
Update: ownerOrEditor,
Delete: administratorsOnly,
},
}Properties
| Property | Type | Description |
|---|---|---|
Admin | AccessRule | Control entry to the admin for this auth collection. |
Create | AccessRule | Control document creation. |
Read | AccessRule | Control and optionally filter reads. |
ReadVersions | AccessRule | Control version-history reads; defaults to Read. |
ReadDrafts | AccessRule | ReadDrafts controls whether an actor sees draft documents of a versioned collection, in addition to Read. It accepts only Allow or Deny. When omitted, only editors do: users of the admin's user collection whose Admin rule lets them in. Anonymous callers and an app's other auth collections read published content, and their explicit draft reads fail. |
Reference | AccessRule | Reference controls which documents of this collection other documents may point at through relationship and upload fields, and may return a Where decision. When omitted, Read is used. Set it to let actors link to documents they may not read, such as sending a friend request to a learner whose profile is private; population still applies Read. |
Update | AccessRule | Control and optionally filter updates. |
Publish | AccessRule | Control publishing and atomic published edits; defaults to Update. |
Unpublish | AccessRule | Control moving published documents to draft; defaults to Update. |
Delete | AccessRule | Control and optionally filter deletion. |
Unlock | AccessRule | Control takeover of another editor's lock; defaults to Update. |
Full signature
type CollectionAccess struct {
// Admin controls whether an authenticated user from this auth collection may
// enter the framework admin. It accepts only Allow or Deny and defaults to
// Allow when omitted.
Admin AccessRule
// Create controls document creation.
Create AccessRule
// Read controls individual and list reads and may return a Where decision.
Read AccessRule
// ReadVersions controls version-history reads and may return a Where
// decision. When omitted, Read is used.
ReadVersions AccessRule
// ReadDrafts controls whether an actor sees draft documents of a versioned
// collection, in addition to Read. It accepts only Allow or Deny. When
// omitted, only editors do: users of the admin's user collection whose
// Admin rule lets them in. Anonymous callers and an app's other auth
// collections read published content, and their explicit draft reads fail.
ReadDrafts AccessRule
// Reference controls which documents of this collection other documents may
// point at through relationship and upload fields, and may return a Where
// decision. When omitted, Read is used. Set it to let actors link to
// documents they may not read, such as sending a friend request to a
// learner whose profile is private; population still applies Read.
Reference AccessRule
// Update controls document updates and may return a Where decision.
Update AccessRule
// Publish controls publishing and atomic published-document edits. When
// omitted, Update is used so existing policies remain coherent.
Publish AccessRule
// Unpublish controls moving a published document back to draft. When
// omitted, Update is used.
Unpublish AccessRule
// Delete controls document deletion and may return a Where decision.
Delete AccessRule
// Unlock controls takeover of another editor's active document lock. When
// omitted, Update is used so existing collection policies remain coherent.
Unlock AccessRule
}