57 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-08-19 16:49:33 +02:00
/* eslint-disable no-unreachable */
2021-07-20 12:12:30 +02:00
'use strict';
2021-08-19 16:49:33 +02:00
// Add permissions
const RBAC_ACTIONS = [
{
section: 'plugins',
displayName: 'Access the Documentation',
uid: 'read',
pluginName: 'documentation',
},
{
section: 'plugins',
displayName: 'Update and delete',
uid: 'settings.update',
pluginName: 'documentation',
},
{
section: 'plugins',
displayName: 'Regenerate',
uid: 'settings.regenerate',
pluginName: 'documentation',
},
2021-10-07 14:03:22 -04:00
{
section: 'settings',
displayName: 'Access the documentation settings page',
uid: 'settings.read',
pluginName: 'documentation',
category: 'documentation',
},
2021-08-19 16:49:33 +02:00
];
2021-09-02 11:25:24 +02:00
/**
*
* @param {{strapi: import("@strapi/strapi").Strapi}} args
*/
module.exports = async ({ strapi }) => {
2021-08-19 16:49:33 +02:00
await strapi.admin.services.permission.actionProvider.registerMany(RBAC_ACTIONS);
2021-09-02 11:25:24 +02:00
const pluginStore = strapi.store({
environment: '',
type: 'plugin',
name: 'documentation',
});
2021-08-19 16:49:33 +02:00
const restrictedAccess = await pluginStore.get({ key: 'config' });
if (!restrictedAccess) {
pluginStore.set({ key: 'config', value: { restrictedAccess: false } });
}
2021-09-02 11:25:24 +02:00
await strapi
.plugin('documentation')
.service('documentation')
.generateFullDoc();
2021-08-19 16:49:33 +02:00
};