I have written a simple REST API with allowguest=true. I use the API to receive a webhook callback from an external application. When the webhook is called, I use frappe.enqueue API in the short topic for a method to be called on the background worker.
Now in the background worker I try to use frappe.new_doc to create a doc and then doc.insert to insert it in the database.
I get a permissions error at doc.insert. I am able to create the same document from a scheduled job. Document currently is available only for System Manager.
Why is it that same document can be created in a background worker in a scheduled job, but fails in case I use frappe.enqueue. Is it because I call enqueue from a allowGuest=True method ?
what is the way out. I want to create a document when I receive a call in webhook, but don’t want this document to be accessible to everyone in the system.