@webbio/strapi-plugin-page-builder 0.16.0-platform → 0.17.0-platform
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/server/bootstrap.ts
CHANGED
|
@@ -77,9 +77,13 @@ export default async ({ strapi }: { strapi: Strapi }) => {
|
|
|
77
77
|
models: [PAGE_UID],
|
|
78
78
|
async beforeCreate(event) {
|
|
79
79
|
let { data } = event.params;
|
|
80
|
+
|
|
81
|
+
console.log('data', event);
|
|
82
|
+
|
|
80
83
|
const collectionTypeId = data?.collectionTypeId;
|
|
81
|
-
|
|
82
|
-
const
|
|
84
|
+
|
|
85
|
+
const pageTypeId = data?.pageType?.connect?.[0]?.id || data.initialPageType;
|
|
86
|
+
const platformId = data?.platform?.connect?.[0]?.id;
|
|
83
87
|
|
|
84
88
|
if (collectionTypeId && pageTypeId) {
|
|
85
89
|
const pageType: Record<string, any> | undefined | null = await strapi.entityService?.findOne(
|
|
@@ -90,7 +90,7 @@ export const extendControllers = () => {
|
|
|
90
90
|
const { user: admin, userAbility } = ctx.state;
|
|
91
91
|
|
|
92
92
|
const { email } = body;
|
|
93
|
-
const platformId = body
|
|
93
|
+
const platformId = body?.platform?.connect?.[0]?.id;
|
|
94
94
|
|
|
95
95
|
const pm = strapi?.admin?.services.permission.createPermissionsManager({
|
|
96
96
|
ability: userAbility,
|
|
@@ -123,7 +123,7 @@ export const extendControllers = () => {
|
|
|
123
123
|
|
|
124
124
|
const advanced = await strapi?.store({ type: 'plugin', name: 'users-permissions', key: 'advanced' }).get({});
|
|
125
125
|
|
|
126
|
-
if (user
|
|
126
|
+
if ((user?.role?.connect?.length || 0) === 0) {
|
|
127
127
|
//@ts-ignore strapi types...
|
|
128
128
|
const defaultRole = await strapi.query(USER_ROLE).findOne({ where: { type: advanced.default_role } });
|
|
129
129
|
user.role = defaultRole.id;
|
|
@@ -148,7 +148,7 @@ export const extendControllers = () => {
|
|
|
148
148
|
const { pm, entity } = await findEntityAndCheckPermissions(userAbility, ACTIONS.edit, USER_MODEL, id);
|
|
149
149
|
const user = entity;
|
|
150
150
|
|
|
151
|
-
const platformId = body
|
|
151
|
+
const platformId = (body?.platform?.connect?.length || 0) > 0 ? body.platform.connect[0].id : entity.platform.id;
|
|
152
152
|
|
|
153
153
|
if (has(body, 'password') && !password && user.provider === 'local') {
|
|
154
154
|
throw new ValidationError('password.notNull');
|