Skip to main content

Module acl

Module acl 

Source
Expand description

Parse ACLs, and the storage form they lower to.

An ACL is a map from principal to permissions. On the wire it is {"*":{"read":true},"role:Admin":{"read":true,"write":true}}. In storage it is two arrays, _rperm and _wperm, each listing the principals holding that permission.

UPSTREAM-QUIRK: the round trip is lossy, and this is Tier 1 bug-compatible. untransformObjectACL (DatabaseController.js:385-406) rebuilds the ACL from the two arrays and only ever sets read: true or write: true. It never writes false. So an entry saved as {"read":true,"write":false} reads back as {"read":true}, with the false key gone. A client could depend on either shape, so reproduce it exactly and do not “fix” it.

Two adjacent behaviors from the same function, both reproduced here:

  • Absent _rperm and _wperm produce no ACL key at all, not null and not {}. The guard is if (_rperm || _wperm).
  • An empty array is truthy in JavaScript, so _rperm: [] with no _wperm produces "ACL": {}, an empty object rather than an absent key. That asymmetry is easy to miss and easy to get wrong in Rust, where both are naturally Option/empty-Vec.

Structs§

Acl
An ACL. Insertion-ordered, because the order of _rperm and _wperm is observable in golden-file comparison even though it carries no meaning.
Permissions
Read and write flags for one principal.

Enums§

Principal
Who a permission applies to.