Hey there! I have a question about custom local plugins. So I have created a new plugin and it seems to work correctly, but… with a “but”.
So I try to manage permissions for it with /admin/src/permissions and for left menu. I’m typing there ‘plugins::xxx.read’ and obviously can’t see it anymore because it’s impossible to manage plugin permissions without enabling such in Settings->Admin->Roles->Role->Plugins->Plugin.
Well… found the way to do it, however it’s undocumented.
You should create a file /plugins/{plugin-name}/config/bootstrap.js. This action is executed by - as I understand it - by actionProvider.register. Here is an example of code, which works for me.
module.exports = async () => {
// set plugin store
registerPermissionActions();
};
const registerPermissionActions = () => {
const actions = [
{
section: 'plugins',
displayName: '<display name of the plugin>',
uid: 'read',
pluginName: '<here goes the name of your plugin>',
}
];
const { actionProvider } = strapi.admin.services.permission;
actionProvider.register(actions);
Hi @eriskhan,
I tried to follow your example, but i still cannot manage permission for my custom plugin. Seems like only Super Admin can see this plugin.
@eriskhan Thanks for the prompt reply. I did a clean and run develop. Do i have to create a permission file under Admin > Src? How do i ensure that plugins/{my plugin}/config/bootstrap.js gets read when strapi develop?