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
_rpermand_wpermproduce noACLkey at all, notnulland not{}. The guard isif (_rperm || _wperm). - An empty array is truthy in JavaScript, so
_rperm: []with no_wpermproduces"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 naturallyOption/empty-Vec.
Structs§
- Acl
- An ACL. Insertion-ordered, because the order of
_rpermand_wpermis 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.