Skip to content

Commit

Permalink
feat(api-headless-cms): empty HCMS trash bin via cron job (#4085)
Browse files Browse the repository at this point in the history
  • Loading branch information
leopuleo authored Apr 24, 2024
1 parent 52c9f8c commit 6ae9e85
Show file tree
Hide file tree
Showing 68 changed files with 1,936 additions and 21 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/pullRequests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ jobs:
--storage=ddb","storage":"ddb","id":"api-file-manager_ddb"},{"cmd":"packages/api-form-builder
--storage=ddb","storage":"ddb","id":"api-form-builder_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb","storage":"ddb","id":"api-headless-cms_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb","storage":"ddb","id":"api-headless-cms-aco_ddb"},{"cmd":"packages/api-i18n
--storage=ddb","storage":"ddb","id":"api-headless-cms-aco_ddb"},{"cmd":"packages/api-headless-cms-tasks
--storage=ddb","storage":"ddb","id":"api-headless-cms-tasks_ddb"},{"cmd":"packages/api-i18n
--storage=ddb","storage":"ddb","id":"api-i18n_ddb"},{"cmd":"packages/api-mailer
--storage=ddb","storage":"ddb","id":"api-mailer_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb","storage":"ddb","id":"api-page-builder_ddb"},{"cmd":"packages/api-page-builder-aco
Expand Down Expand Up @@ -289,7 +290,8 @@ jobs:
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-form-builder-so-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-aco_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-tasks
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-tasks_ddb-es_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-mailer_ddb-es_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-page-builder_ddb-es_ddb"},{"cmd":"packages/api-page-builder-aco
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-page-builder-aco_ddb-es_ddb"},{"cmd":"packages/api-page-builder-so-ddb-es
Expand Down Expand Up @@ -357,7 +359,8 @@ jobs:
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-form-builder-so-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-aco_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-tasks
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-tasks_ddb-os_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-mailer_ddb-os_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-page-builder_ddb-os_ddb"},{"cmd":"packages/api-page-builder-aco
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-page-builder-aco_ddb-os_ddb"},{"cmd":"packages/api-page-builder-so-ddb-es
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/pushDev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ jobs:
--storage=ddb","storage":"ddb","id":"api-file-manager_ddb"},{"cmd":"packages/api-form-builder
--storage=ddb","storage":"ddb","id":"api-form-builder_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb","storage":"ddb","id":"api-headless-cms_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb","storage":"ddb","id":"api-headless-cms-aco_ddb"},{"cmd":"packages/api-i18n
--storage=ddb","storage":"ddb","id":"api-headless-cms-aco_ddb"},{"cmd":"packages/api-headless-cms-tasks
--storage=ddb","storage":"ddb","id":"api-headless-cms-tasks_ddb"},{"cmd":"packages/api-i18n
--storage=ddb","storage":"ddb","id":"api-i18n_ddb"},{"cmd":"packages/api-mailer
--storage=ddb","storage":"ddb","id":"api-mailer_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb","storage":"ddb","id":"api-page-builder_ddb"},{"cmd":"packages/api-page-builder-aco
Expand Down Expand Up @@ -255,7 +256,8 @@ jobs:
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-form-builder-so-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-aco_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-tasks
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-tasks_ddb-es_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-mailer_ddb-es_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-page-builder_ddb-es_ddb"},{"cmd":"packages/api-page-builder-aco
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-page-builder-aco_ddb-es_ddb"},{"cmd":"packages/api-page-builder-so-ddb-es
Expand Down Expand Up @@ -322,7 +324,8 @@ jobs:
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-form-builder-so-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-aco_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-tasks
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-tasks_ddb-os_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-mailer_ddb-os_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-page-builder_ddb-os_ddb"},{"cmd":"packages/api-page-builder-aco
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-page-builder-aco_ddb-os_ddb"},{"cmd":"packages/api-page-builder-so-ddb-es
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/pushNext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ jobs:
--storage=ddb","storage":"ddb","id":"api-file-manager_ddb"},{"cmd":"packages/api-form-builder
--storage=ddb","storage":"ddb","id":"api-form-builder_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb","storage":"ddb","id":"api-headless-cms_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb","storage":"ddb","id":"api-headless-cms-aco_ddb"},{"cmd":"packages/api-i18n
--storage=ddb","storage":"ddb","id":"api-headless-cms-aco_ddb"},{"cmd":"packages/api-headless-cms-tasks
--storage=ddb","storage":"ddb","id":"api-headless-cms-tasks_ddb"},{"cmd":"packages/api-i18n
--storage=ddb","storage":"ddb","id":"api-i18n_ddb"},{"cmd":"packages/api-mailer
--storage=ddb","storage":"ddb","id":"api-mailer_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb","storage":"ddb","id":"api-page-builder_ddb"},{"cmd":"packages/api-page-builder-aco
Expand Down Expand Up @@ -255,7 +256,8 @@ jobs:
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-form-builder-so-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-aco_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-tasks
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-tasks_ddb-es_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-mailer_ddb-es_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-page-builder_ddb-es_ddb"},{"cmd":"packages/api-page-builder-aco
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-page-builder-aco_ddb-es_ddb"},{"cmd":"packages/api-page-builder-so-ddb-es
Expand Down Expand Up @@ -322,7 +324,8 @@ jobs:
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-form-builder-so-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-aco_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-tasks
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-tasks_ddb-os_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-mailer_ddb-os_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-page-builder_ddb-os_ddb"},{"cmd":"packages/api-page-builder-aco
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-page-builder-aco_ddb-os_ddb"},{"cmd":"packages/api-page-builder-so-ddb-es
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/wac/utils/listPackagesWithJestTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ const CUSTOM_HANDLERS: Record<string, () => Array<PackageWithTests>> = {
{ cmd: "packages/api-headless-cms-aco --storage=ddb-os,ddb", storage: "ddb-os" }
];
},
"api-headless-cms-tasks": () => {
return [
{ cmd: "packages/api-headless-cms-tasks --storage=ddb", storage: "ddb" },
{ cmd: "packages/api-headless-cms-tasks --storage=ddb-es,ddb", storage: "ddb-es" },
{ cmd: "packages/api-headless-cms-tasks --storage=ddb-os,ddb", storage: "ddb-os" }
];
},
"api-apw": () => {
return [
{ cmd: "packages/api-apw --storage=ddb", storage: "ddb" }
Expand Down
1 change: 1 addition & 0 deletions apps/api/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@webiny/api-headless-cms": "0.0.0",
"@webiny/api-headless-cms-aco": "0.0.0",
"@webiny/api-headless-cms-ddb": "0.0.0",
"@webiny/api-headless-cms-tasks": "0.0.0",
"@webiny/api-i18n": "0.0.0",
"@webiny/api-i18n-content": "0.0.0",
"@webiny/api-i18n-ddb": "0.0.0",
Expand Down
6 changes: 4 additions & 2 deletions apps/api/graphql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { createFormBuilder } from "@webiny/api-form-builder";
import { createFormBuilderStorageOperations } from "@webiny/api-form-builder-so-ddb";
import { createHeadlessCmsContext, createHeadlessCmsGraphQL } from "@webiny/api-headless-cms";
import { createAcoHcmsContext } from "@webiny/api-headless-cms-aco";
import { createHcmsTasks } from "@webiny/api-headless-cms-tasks";
import { createStorageOperations as createHeadlessCmsStorageOperations } from "@webiny/api-headless-cms-ddb";
import securityPlugins from "./security";
import tenantManager from "@webiny/api-tenant-manager";
Expand Down Expand Up @@ -102,6 +103,8 @@ export const handler = createHandler({
}),
createAco(),
createAcoPageBuilderContext(),
createAcoHcmsContext(),
createHcmsTasks(),
scaffoldsPlugins(),
createFileModelModifier(({ modifier }) => {
modifier.addField({
Expand Down Expand Up @@ -129,8 +132,7 @@ export const handler = createHandler({
}),
createAuditLogs(),
createCountDynamoDbTask(),
createContinuingTask(),
createAcoHcmsContext()
createContinuingTask()
],
debug
});
4 changes: 3 additions & 1 deletion apps/api/graphql/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { AcoContext } from "@webiny/api-aco/types";
import { PbAcoContext } from "@webiny/api-page-builder-aco/types";
import { Context as TasksContext } from "@webiny/tasks/types";
import { HcmsAcoContext } from "@webiny/api-headless-cms-aco/types";
import { HcmsTasksContext } from "@webiny/api-headless-cms-tasks/types";

// When working with the `context` object (for example while defining a new GraphQL resolver function),
// you can import this interface and assign it to it. This will give you full autocomplete functionality
Expand All @@ -27,4 +28,5 @@ export interface Context
AcoContext,
TasksContext,
PbAcoContext,
HcmsAcoContext {}
HcmsAcoContext,
HcmsTasksContext {}
5 changes: 5 additions & 0 deletions apps/api/graphql/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
{
"path": "../../../packages/api-headless-cms-aco/tsconfig.build.json"
},
{
"path": "../../../packages/api-headless-cms-tasks/tsconfig.build.json"
},
{
"path": "../../../packages/api-headless-cms-ddb/tsconfig.build.json"
},
Expand Down Expand Up @@ -150,6 +153,8 @@
"@webiny/api-headless-cms-aco": ["../../../packages/api-headless-cms-aco/src"],
"@webiny/api-headless-cms-ddb/*": ["../../../packages/api-headless-cms-ddb/src/*"],
"@webiny/api-headless-cms-ddb": ["../../../packages/api-headless-cms-ddb/src"],
"@webiny/api-headless-cms-tasks/*": ["../../../packages/api-headless-cms-tasks/src/*"],
"@webiny/api-headless-cms-tasks": ["../../../packages/api-headless-cms-tasks/src"],
"@webiny/api-i18n/*": ["../../../packages/api-i18n/src/*"],
"@webiny/api-i18n": ["../../../packages/api-i18n/src"],
"@webiny/api-i18n-content/*": ["../../../packages/api-i18n-content/src/*"],
Expand Down
1 change: 1 addition & 0 deletions packages/api-headless-cms-tasks/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@webiny/project-utils").createBabelConfigForNode({ path: __dirname });
21 changes: 21 additions & 0 deletions packages/api-headless-cms-tasks/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Webiny

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions packages/api-headless-cms-tasks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# @webiny/api-headless-cms-tasks
[![](https://img.shields.io/npm/dw/@webiny/api-headless-cms-tasks.svg)](https://www.npmjs.com/package/@webiny/api-headless-cms-tasks)
[![](https://img.shields.io/npm/v/@webiny/api-headless-cms-tasks.svg)](https://www.npmjs.com/package/@webiny/api-headless-cms-tasks)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

## Install
```
npm install --save @webiny/api-headless-cms-tasks
```

Or if you prefer yarn:
```
yarn add @webiny/api-headless-cms-tasks
```
72 changes: 72 additions & 0 deletions packages/api-headless-cms-tasks/__tests__/context/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { SecurityIdentity } from "@webiny/api-security/types";
import { ContextPlugin } from "@webiny/api";
import { HeadlessCmsTasksContext } from "~/types";

export interface PermissionsArg {
name: string;
locales?: string[];
rwd?: string;
pw?: string;
own?: boolean;
}

export const identity = {
id: "id-12345678",
displayName: "John Doe",
type: "admin"
};

const getSecurityIdentity = () => {
return identity;
};

export const createPermissions = (permissions?: PermissionsArg[]): PermissionsArg[] => {
if (permissions) {
return permissions;
}
return [
{
name: "task.entry",
rwd: "rwd"
},
{
name: "content.i18n",
locales: ["en-US", "de-DE"]
},
{
name: "*"
}
];
};

export const createIdentity = (identity?: SecurityIdentity) => {
if (!identity) {
return getSecurityIdentity();
}
return identity;
};

export const createDummyLocales = () => {
return new ContextPlugin<HeadlessCmsTasksContext>(async context => {
const { i18n, security } = context;

await security.authenticate("");

await security.withoutAuthorization(async () => {
const [items] = await i18n.locales.listLocales({
where: {}
});
if (items.length > 0) {
return;
}
await i18n.locales.createLocale({
code: "en-US",
default: true
});
await i18n.locales.createLocale({
code: "de-DE",
default: true
});
});
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { Plugin } from "@webiny/plugins/Plugin";
import { createTenancyContext, createTenancyGraphQL } from "@webiny/api-tenancy";
import { createSecurityContext, createSecurityGraphQL } from "@webiny/api-security";
import {
SecurityIdentity,
SecurityPermission,
SecurityStorageOperations
} from "@webiny/api-security/types";
import { ContextPlugin } from "@webiny/api";
import { BeforeHandlerPlugin } from "@webiny/handler";
import { HeadlessCmsTasksContext } from "~/types";
import { getStorageOps } from "@webiny/project-utils/testing/environment";
import { TenancyStorageOperations, Tenant } from "@webiny/api-tenancy/types";

interface Config {
setupGraphQL?: boolean;
permissions: SecurityPermission[];
identity?: SecurityIdentity | null;
}

export const defaultIdentity: SecurityIdentity = {
id: "id-12345678",
type: "admin",
displayName: "John Doe"
};

export const createTenancyAndSecurity = ({
setupGraphQL,
permissions,
identity
}: Config): Plugin[] => {
const tenancyStorage = getStorageOps<TenancyStorageOperations>("tenancy");
const securityStorage = getStorageOps<SecurityStorageOperations>("security");

return [
createTenancyContext({ storageOperations: tenancyStorage.storageOperations }),
setupGraphQL ? createTenancyGraphQL() : null,
createSecurityContext({ storageOperations: securityStorage.storageOperations }),
setupGraphQL ? createSecurityGraphQL() : null,
new ContextPlugin<HeadlessCmsTasksContext>(context => {
context.tenancy.setCurrentTenant({
id: "root",
name: "Root",
webinyVersion: context.WEBINY_VERSION
} as unknown as Tenant);

context.security.addAuthenticator(async () => {
return identity || defaultIdentity;
});

context.security.addAuthorizer(async () => {
const { headers = {} } = context.request || {};
if (headers["authorization"]) {
return null;
}

return permissions || [{ name: "*" }];
});
}),
new BeforeHandlerPlugin<HeadlessCmsTasksContext>(context => {
const { headers = {} } = context.request || {};
if (headers["authorization"]) {
return context.security.authenticate(headers["authorization"]);
}

return context.security.authenticate("");
})
].filter(Boolean) as Plugin[];
};
Loading

0 comments on commit 6ae9e85

Please sign in to comment.