type

CollectionAccess

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 // 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 }

Access rules for collection reads and mutations.

Source core/access.go:138

AdminAccessRule
Control entry to the admin for this auth collection.
CreateAccessRule
Control document creation.
ReadAccessRule
Control and optionally filter reads.
ReadVersionsAccessRule
Control version-history reads; defaults to Read.
UpdateAccessRule
Control and optionally filter updates.
PublishAccessRule
Control publishing and atomic published edits; defaults to Update.
UnpublishAccessRule
Control moving published documents to draft; defaults to Update.
DeleteAccessRule
Control and optionally filter deletion.
UnlockAccessRule
Control takeover of another editor's lock; defaults to Update.

Example

go
var Posts = ridu.Collection{
  Access: ridu.CollectionAccess{
    Create: authenticated,
    Read:   publishedOrOwner,
    Update: ownerOrEditor,
    Delete: administratorsOnly,
  },
}