I found the solution ! But you will have to take the enterprise edition.
The first thing to do is to edit the file /plugins/YourPlugin/server/bootstrap.js
'use strict';
// Role Based Access Control
const RBAC_ACTIONS = [
{
section: 'plugins',
displayName: 'A description of the role',
uid: 'read',
pluginName: 'your-plugin-name',
},
];
/**
*
* @param {{strapi: import("@strapi/strapi").Strapi}} args
*/
module.exports = async ({ strapi }) => {
await strapi.admin.services.permission.actionProvider.registerMany(RBAC_ACTIONS);
const pluginStore = strapi.store({
environment: '',
type: 'plugin',
name: 'your-plugin-name',
});
};
Then you add the permission into the file /plugins/YourPlugin/admin/index.js
register(app) {
app.addMenuLink({
to: `/plugins/${ pluginId }`,
icon: PluginIcon,
intlLabel: {
id: `${ pluginId }.plugin.name`,
defaultMessage: "My Plugin",
},
Component: async () => {
const component = await import(/* webpackChunkName: "[request]" */ './pages/App');
return component;
},
permissions: [
{
action: "plugin::your-plugin-name.read",
subject: null
}
]
});
app.registerPlugin({
id: pluginId,
initializer: Initializer,
isReady: false,
name,
});
},
You can add other roles in the array RBAC_ACTIONS. The uid property is what you call in your action.
Once you’ve done that. Build your project. Log as Super Admin and go to the settings > Administration Panel > Roles
Then edit a role. Go to the plugins tab. You will see your plugin with the role you add in RBAC_ACTIONS.
If you have the community edition. The checkbox will be disabled. You have to buy a licence to manipulate the roles. You can test the enterprise edition for free during 14 days.
Good luck