initial commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import type { Core } from '@strapi/strapi';
|
||||
|
||||
import { revokePublicAuthActions } from './auth-permissions';
|
||||
import { LOG_PREFIX } from './constants';
|
||||
import { ensureLocales } from './locales';
|
||||
import { ensurePublicPermissions } from './public-permissions';
|
||||
|
||||
export { revokePublicAuthActions } from './auth-permissions';
|
||||
export { ensureLocales } from './locales';
|
||||
export { ensurePublicPermissions } from './public-permissions';
|
||||
|
||||
/**
|
||||
* Boot-time reconciliation, run from `src/index.ts`.
|
||||
*
|
||||
* Every step is idempotent: the first two only add what is missing, and the
|
||||
* third only removes grants this site has decided it never wants. Running the
|
||||
* lot on each boot - including on every hot reload in development - leaves an
|
||||
* already-reconciled instance untouched.
|
||||
*
|
||||
* Runs after the plugin bootstraps, so the `en` locale and the Public role that
|
||||
* Strapi creates on a fresh database already exist here - including the auth
|
||||
* permissions users-permissions grants that role by default, which is exactly
|
||||
* what the third step takes back.
|
||||
*/
|
||||
export const runBootstrap = async ({ strapi }: { strapi: Core.Strapi }): Promise<void> => {
|
||||
await ensureLocales(strapi);
|
||||
await ensurePublicPermissions(strapi);
|
||||
await revokePublicAuthActions(strapi);
|
||||
|
||||
strapi.log.debug(`${LOG_PREFIX} bootstrap complete.`);
|
||||
};
|
||||
Reference in New Issue
Block a user