You can add permissions to plugins what would only allow for users with that specific permission to see it
in server/bootstrap.js
module.exports = async ({ strapi }) => {
const actions = [
{
section: 'plugins',
displayName: 'Read',
uid: 'read',
pluginName: 'protected-populate',
},
];
await strapi.admin.services.permission.actionProvider.registerMany(actions);
};
then in your admin you would need to add the following 3 things
admin/src/permissions.js
const pluginPermissions = {
main: [{ action: 'plugin::protected-populate.read', subject: null }],
};
export default pluginPermissions;
admin/src/pages/app/index.js
import React from 'react';
import { Switch, Route } from 'react-router-dom';
import { NotFound, CheckPagePermissions } from '@strapi/helper-plugin';
import pluginId from '../../pluginId';
import pluginPermissions from '../../permissions';
import HomePage from '../HomePage';
const App = () => {
return (
<CheckPagePermissions permissions={pluginPermissions.main}>
<Switch>
<Route path={`/plugins/${pluginId}`} component={HomePage} exact />
<Route component={NotFound} />
</Switch>
</CheckPagePermissions>
);
};
export default App;
and in admin/src/index.js where you register your app to the menu
export default {
register(app) {
app.addMenuLink({
to: `/plugins/${pluginId}`,
icon: PluginIcon,
intlLabel: {
id: `${pluginId}.plugin.displayName`,
defaultMessage: name,
},
permissions: pluginPermissions.main,
Component: async () => {
const component = await import(/* webpackChunkName: "[request]" */ './pages/App');
return component;
},
});
app.registerPlugin({
id: pluginId,
initializer: Initializer,
isReady: false,
name,
});
},
only thing you should care about is the permissions section