You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Adding a bunch more tests. I feel like the coverage is there and this probably mostly works now
- Adding a `permissions` option to find queries. If that's set to try, permissions will be injected into the returned object.
- Readme is sorta decent, but not really.
You can also have the permissions for a specific document injected into the document when returned from a find query using the `permissions` option on the query. The permissions will be inserted into the object using the key `permissions` unless you specify the desired key name as the permissions option.
140
+
141
+
```javascript
142
+
const user = await User.find().setOptions({ authLevel: 'admin': permissions: true }).exec();
143
+
144
+
console.log(user.permissions);
145
+
// Outputs:
146
+
// {
147
+
// read: [...],
148
+
// write: [...],
149
+
// remove: [boolean]
150
+
// }
151
+
152
+
// OR
153
+
const user = await User.find().setOptions({ authLevel: 'admin': permissions: 'foo' }).exec();
154
+
155
+
console.log(user.foo);
156
+
// Outputs:
157
+
// {
158
+
// read: [...],
159
+
// write: [...],
160
+
// remove: [boolean]
161
+
// }
162
+
```
163
+
139
164
#### Example Uses
140
165
141
166
###### NOTE: If no authLevel is able to be determined, permission to perform the action will be denied. If you would like to circumvent authorization, pass `false` as the authLevel (e.g. `myModel.find().setAuhtLevel(false).exec();`, which will disable authorization for that specific query).
0 commit comments