Skip to content

Commit 03c27f3

Browse files
committed
Add allow* method arguments
1 parent c68d952 commit 03c27f3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/technical-details/reference/resource.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,21 +209,21 @@ This is called when a connection is received through WebSockets or Server Sent E
209209
210210
This will assign the provided value to the designated property in the resource's record. During a write operation, this will indicate that the record has changed and the changes will be saved during commit. During a read operation, this will modify the copy of the record that will be serialized during serialization (converted to the output format of JSON, MessagePack, etc.).
211211
212-
### `allowCreate(user): boolean`
212+
### `allowCreate(user: any, data: Promise, context: Context): boolean | Promise<boolean>`
213213
214-
This is called to determine if the user has permission to create the current resource. This is called as part of external incoming requests (HTTP). The default behavior for a generic resource is that this requires super-user permission and the default behavior for a table is to check the user's role's insert permission to the table.
214+
This is called to determine if the user has permission to create the current resource. This is called as part of external incoming requests (HTTP). The default behavior for a generic resource is that this requires super-user permission and the default behavior for a table is to check the user's role's insert permission to the table. The allow method may be asynchronous and return a promise that resolves to a boolean, and may await the `data` promise to determine if the data is valid for creation.
215215
216-
### `allowRead(user): boolean`
216+
### `allowRead(user: any, query: Map | void, context: Context): boolean | Promise<boolean>`
217217
218-
This is called to determine if the user has permission to read from the current resource. This is called as part of external incoming requests (HTTP GET). The default behavior for a generic resource is that this requires super-user permission and the default behavior for a table is to check the user's role's read permission to the table.
218+
This is called to determine if the user has permission to read from the current resource. This is called as part of external incoming requests (HTTP GET). The default behavior for a generic resource is that this requires super-user permission and the default behavior for a table is to check the user's role's read permission to the table. The allow method may be asynchronous and return a promise that resolves to a boolean.
219219
220-
### `allowUpdate(user): boolean`
220+
### `allowUpdate(user: any, data: Promise, context: Context): boolean | Promise<boolean>`
221221
222-
This is called to determine if the user has permission to update the current resource. This is called as part of external incoming requests (HTTP PUT). The default behavior for a generic resource is that this requires super-user permission and the default behavior for a table is to check the user's role's update permission to the table.
222+
This is called to determine if the user has permission to update the current resource. This is called as part of external incoming requests (HTTP PUT). The default behavior for a generic resource is that this requires super-user permission and the default behavior for a table is to check the user's role's update permission to the table. The allow method may be asynchronous and return a promise that resolves to a boolean, and may await the `data` promise to determine if the data is valid for creation.
223223
224-
### `allowDelete(user): boolean`
224+
### `allowDelete(user: any, query: Map | void, context: Context): boolean | Promise<boolean>`
225225
226-
This is called to determine if the user has permission to delete the current resource. This is called as part of external incoming requests (HTTP DELETE). The default behavior for a generic resource is that this requires super-user permission and the default behavior for a table is to check the user's role's delete permission to the table.
226+
This is called to determine if the user has permission to delete the current resource. This is called as part of external incoming requests (HTTP DELETE). The default behavior for a generic resource is that this requires super-user permission and the default behavior for a table is to check the user's role's delete permission to the table. The allow method may be asynchronous and return a promise that resolves to a boolean.
227227
228228
### `addTo(property, value)`
229229

0 commit comments

Comments
 (0)