Bypass category permissions to post topic
-
Hello,
I've currently created a plugin that adds a "ban appeal form" to our website, and it works as intended, however, we want to force people to use this form rather than manually create a topic in the category.
However when I disable the topic creation permission, obviously when the form is filled out and submitted, it cannot create the topic.
I'm currently using this to post the topic:
const topics = require.main.require('./src/topics'); ..... topics.post(payload, (error, data) => {..........
Is there an alternative method I can use to bypass the permission to allow the plugin to post in the category?
-
You could try intercepting the privileges hook https://github.com/NodeBB/NodeBB/blob/master/src/privileges/helpers.js#L26. But I'm not sure how you'd only enable it for your call. Maybe you could use async local storage. https://docs.adonisjs.com/guides/async-local-storage