2020-03-06 13:33:07 +01:00
|
|
|
// NOTE TO PLUGINS DEVELOPERS:
|
|
|
|
// If you modify this file by adding new options to the plugin entry point
|
|
|
|
// Here's the file: strapi/docs/3.0.0-beta.x/plugin-development/frontend-field-api.md
|
|
|
|
// Here's the file: strapi/docs/3.0.0-beta.x/guides/registering-a-field-in-admin.md
|
|
|
|
// Also the strapi-generate-plugins/files/admin/src/index.js needs to be updated
|
|
|
|
// IF THE DOC IS NOT UPDATED THE PULL REQUEST WILL NOT BE MERGED
|
2021-07-28 08:16:15 +02:00
|
|
|
import { prefixPluginTranslations } from '@strapi/helper-plugin';
|
2019-04-16 16:55:53 +02:00
|
|
|
import pluginPkg from '../../package.json';
|
2020-06-10 14:52:09 +02:00
|
|
|
import pluginPermissions from './permissions';
|
2019-04-16 16:55:53 +02:00
|
|
|
import pluginId from './pluginId';
|
2020-08-03 16:49:40 +02:00
|
|
|
import getTrad from './utils/getTrad';
|
2019-04-16 16:55:53 +02:00
|
|
|
|
2021-05-10 14:02:47 +02:00
|
|
|
const name = pluginPkg.strapi.name;
|
2019-04-16 16:55:53 +02:00
|
|
|
|
2021-05-10 14:02:47 +02:00
|
|
|
export default {
|
|
|
|
register(app) {
|
2021-06-08 09:02:20 +02:00
|
|
|
// Create the plugin's settings section
|
2021-06-09 12:22:02 +02:00
|
|
|
app.createSettingSection(
|
2021-06-08 09:02:20 +02:00
|
|
|
{
|
|
|
|
id: pluginId,
|
|
|
|
intlLabel: {
|
|
|
|
id: getTrad('Settings.section-label'),
|
|
|
|
defaultMessage: 'Users & Permissions plugin',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[
|
|
|
|
{
|
|
|
|
intlLabel: {
|
|
|
|
id: getTrad('HeaderNav.link.roles'),
|
|
|
|
defaultMessage: 'Roles',
|
|
|
|
},
|
|
|
|
id: 'roles',
|
|
|
|
to: `/settings/${pluginId}/roles`,
|
2021-07-28 08:16:15 +02:00
|
|
|
Component: async () => {
|
2021-08-19 09:42:19 +02:00
|
|
|
const component = await import(
|
|
|
|
/* webpackChunkName: "users-roles-settings-page" */ './pages/Roles'
|
|
|
|
);
|
2021-07-28 08:16:15 +02:00
|
|
|
|
|
|
|
return component;
|
|
|
|
},
|
2021-06-08 09:02:20 +02:00
|
|
|
permissions: pluginPermissions.accessRoles,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
intlLabel: {
|
|
|
|
id: getTrad('HeaderNav.link.providers'),
|
|
|
|
defaultMessage: 'Providers',
|
|
|
|
},
|
|
|
|
id: 'providers',
|
|
|
|
to: `/settings/${pluginId}/providers`,
|
2021-07-28 08:16:15 +02:00
|
|
|
Component: async () => {
|
|
|
|
const component = await import(
|
2021-08-19 09:42:19 +02:00
|
|
|
/* webpackChunkName: "users-providers-settings-page" */ './pages/Providers'
|
2021-07-28 08:16:15 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
return component;
|
|
|
|
},
|
2021-06-08 09:02:20 +02:00
|
|
|
permissions: pluginPermissions.readProviders,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
intlLabel: {
|
2021-08-04 19:24:10 +02:00
|
|
|
id: getTrad('HeaderNav.link.emailTemplates'),
|
2021-06-08 09:02:20 +02:00
|
|
|
defaultMessage: 'Email templates',
|
|
|
|
},
|
|
|
|
id: 'email-templates',
|
|
|
|
to: `/settings/${pluginId}/email-templates`,
|
2021-07-28 08:16:15 +02:00
|
|
|
Component: async () => {
|
|
|
|
const component = await import(
|
2021-08-19 09:42:19 +02:00
|
|
|
/* webpackChunkName: "users-email-settings-page" */ './pages/EmailTemplates'
|
2021-07-28 08:16:15 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
return component;
|
|
|
|
},
|
2021-06-08 09:02:20 +02:00
|
|
|
permissions: pluginPermissions.readEmailTemplates,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
intlLabel: {
|
2021-08-04 19:24:10 +02:00
|
|
|
id: getTrad('HeaderNav.link.advancedSettings'),
|
2021-06-08 09:02:20 +02:00
|
|
|
defaultMessage: 'Advanced Settings',
|
|
|
|
},
|
|
|
|
id: 'advanced-settings',
|
|
|
|
to: `/settings/${pluginId}/advanced-settings`,
|
2021-07-28 08:16:15 +02:00
|
|
|
Component: async () => {
|
|
|
|
const component = await import(
|
2021-08-19 09:42:19 +02:00
|
|
|
/* webpackChunkName: "users-advanced-settings-page" */ './pages/AdvancedSettings'
|
2021-07-28 08:16:15 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
return component;
|
|
|
|
},
|
2021-06-08 09:02:20 +02:00
|
|
|
permissions: pluginPermissions.readAdvancedSettings,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
2021-05-10 14:02:47 +02:00
|
|
|
app.registerPlugin({
|
|
|
|
id: pluginId,
|
|
|
|
name,
|
|
|
|
});
|
|
|
|
},
|
2021-07-21 09:05:20 +02:00
|
|
|
bootstrap() {},
|
2021-06-09 11:22:23 +02:00
|
|
|
async registerTrads({ locales }) {
|
|
|
|
const importedTrads = await Promise.all(
|
|
|
|
locales.map(locale => {
|
|
|
|
return import(
|
|
|
|
/* webpackChunkName: "users-permissions-translation-[request]" */ `./translations/${locale}.json`
|
|
|
|
)
|
|
|
|
.then(({ default: data }) => {
|
|
|
|
return {
|
2021-06-09 12:11:51 +02:00
|
|
|
data: prefixPluginTranslations(data, pluginId),
|
2021-06-09 11:22:23 +02:00
|
|
|
locale,
|
|
|
|
};
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
return {
|
|
|
|
data: {},
|
|
|
|
locale,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
return Promise.resolve(importedTrads);
|
|
|
|
},
|
2019-04-16 16:55:53 +02:00
|
|
|
};
|