({ ACL, ...result })
| 91 | |
| 92 | // Transforms a REST API formatted ACL object to our two-field mongo format. |
| 93 | const transformObjectACL = ({ ACL, ...result }) => { |
| 94 | if (!ACL) { |
| 95 | return result; |
| 96 | } |
| 97 | |
| 98 | result._wperm = []; |
| 99 | result._rperm = []; |
| 100 | |
| 101 | for (const entry in ACL) { |
| 102 | if (ACL[entry].read) { |
| 103 | result._rperm.push(entry); |
| 104 | } |
| 105 | if (ACL[entry].write) { |
| 106 | result._wperm.push(entry); |
| 107 | } |
| 108 | } |
| 109 | return result; |
| 110 | }; |
| 111 | |
| 112 | const validateQuery = ( |
| 113 | query: any, |