mirror of
https://github.com/strapi/strapi.git
synced 2025-08-31 12:23:05 +00:00
51 lines
1.2 KiB
TypeScript
Executable File
51 lines
1.2 KiB
TypeScript
Executable File
import type { Core } from '@strapi/types';
|
|
|
|
import { getService } from './utils';
|
|
|
|
// 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',
|
|
},
|
|
{
|
|
section: 'settings',
|
|
displayName: 'Access the documentation settings page',
|
|
uid: 'settings.read',
|
|
pluginName: 'documentation',
|
|
category: 'documentation',
|
|
},
|
|
];
|
|
|
|
export async function bootstrap({ strapi }: { strapi: Core.Strapi }) {
|
|
await strapi.service('admin::permission').actionProvider.registerMany(RBAC_ACTIONS);
|
|
|
|
const pluginStore = strapi.store!({
|
|
environment: '',
|
|
type: 'plugin',
|
|
name: 'documentation',
|
|
});
|
|
|
|
const config = await pluginStore.get({ key: 'config' });
|
|
|
|
if (!config) {
|
|
pluginStore.set({ key: 'config', value: { restrictedAccess: false } });
|
|
}
|
|
|
|
await getService('documentation').generateFullDoc();
|
|
}
|