I am trying to create my own custom plugin in Strapi. I have created one through the CLI (with the generate command) and after registering my plugin, it shows up in the navigation. However, I want to limit the access of the API endpoints. For this, I tried to change the settings in the Users & Permissions plugin but my custom plugin does not show up there.
What am I doing wrong? Do I have to register the plugin anywhere specifically for the Users & Permissions plugin?
What I did so far:
Great question!
You need to open a custom route in user-permission, let me guide you
create a file of your name at user-psermissions/controllers/example.js
paste this below code and edit it as per requirement
module.exports = plugin => {
plugin.controllers.user.example = async ctx => {
// ... codes
};
plugin.routes['content-api'].routes.push({
method: 'PUT',
path: '/user/example',
handler: 'user.example',
config: {
prefix: '',
policies: [],
},
});
return plugin;
};