Managing admin permissions for custom local plugins

System Information
  • Strapi Version: 3.4.1EE
  • Operating System: Ubuntu 18.04 LTS
  • Database: Postgres
  • Node Version: 12.18.3
  • NPM Version:
  • Yarn Version:

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.

So my question is: what is the way to add my plugin and permissions (policies) to this panel? Thanks!

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);
1 Like

Then you can execute checking of permissions with “plugins::[the name of your plugin].[uid of a permission]”. For example, “plugins::address.read”.

I have created the config/bootstrap.js, but can see the plugin name appearing in the under /plugins/{plugin-name}/config/bootstrap.js,Thank you

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.

Any advice?

Hey there @kevinng!
Could you please DM me on Strapi Slack with an example of your code? I’ll try to dive into it.

And have you done yarn build --clean after the changes?

@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?

On my side of things, the bootstrap file to edit wasn’t the one in the plugin folder but the one located at the root of the project

under PROJECTROOT/config/functions/bootstrap.js

Yes you are right! It needs to be under functions folder!