type

CollectionAccess

Access rules for collection reads and mutations.

Example

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

Properties

PropertyTypeDescription
AdminAccessRuleControl entry to the admin for this auth collection.
CreateAccessRuleControl document creation.
ReadAccessRuleControl and optionally filter reads.
ReadVersionsAccessRuleControl version-history reads; defaults to Read.
ReadDraftsAccessRuleReadDrafts 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.
ReferenceAccessRuleReference 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.
UpdateAccessRuleControl and optionally filter updates.
PublishAccessRuleControl publishing and atomic published edits; defaults to Update.
UnpublishAccessRuleControl moving published documents to draft; defaults to Update.
DeleteAccessRuleControl and optionally filter deletion.
UnlockAccessRuleControl 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 }

Source core/access.go:95