Is it possible to block a document create from a server function that is subscribed to the create event?
As means of an additional layer of security?
For my use case it would be to prevent muted users from sending messages during their mute period.
Summary
The user wants to know if it's possible to prevent a document from being created using a server function. Several suggestions are given, including using a validation function and changing permissions in the collection. However, it is noted that Appwrite functions cannot be placed between processes. There is no clear solution provided in the thread.
Binyamin
Jun 15, 2023, 01:08
Like a middleware-function?
That will be cool but as of now Appwrite function can't go in between some processes.
What you can do now:
Change permission to a collection - by specific roles for example.
Delete them right away - this is probably not what you've been looking for.
i typically prevent creation via the API and expose a function to create the document. the function can do any validation and only create the document if validation passes
saricden
Rank 2: Process
Jun 15, 2023, 02:18
Okay, makes sense, thanks guys 🙂
animeyeet
Jun 15, 2023, 04:49
create 2 fx. make one for validation and other whatever you like. second fx tigger validation fx and validation fx trigger doc. creation