@webbio/strapi-plugin-page-builder 0.12.7-platform → 0.13.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/README.md +5 -1
- package/admin/src/api/page-type-exists.ts +44 -0
- package/admin/src/api/search-filtered-entity.ts +22 -6
- package/admin/src/components/EditView/CollectionTypeSettings/index.tsx +17 -6
- package/admin/src/components/EditView/Details/styles.ts +11 -1
- package/admin/src/components/PageFilters/filters.tsx +18 -10
- package/admin/src/components/PlatformFilteredSelectField/Multi/index.tsx +10 -8
- package/admin/src/components/PlatformFilteredSelectField/Single/index.tsx +31 -17
- package/admin/src/components/PlatformFilteredSelectField/styles.tsx +20 -1
- package/admin/src/components/PlatformFilteredSelectField/utils/relation-helper.ts +5 -1
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/RelationInput.tsx +41 -15
- package/admin/src/utils/hooks/useQueryParams.ts +52 -0
- package/dist/package.json +1 -1
- package/dist/server/bootstrap/permissions.js +19 -16
- package/dist/server/bootstrap.js +17 -15
- package/dist/server/content-types/user-categories/schema.json +18 -0
- package/dist/server/controllers/private-content.js +1 -1
- package/dist/server/services/email.js +2 -0
- package/dist/tsconfig.server.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/server/bootstrap/permissions.ts +21 -17
- package/server/bootstrap.ts +25 -16
- package/server/controllers/private-content.ts +1 -1
- package/server/services/email.ts +2 -0
package/package.json
CHANGED
|
@@ -33,27 +33,31 @@ export default async ({ strapi }: { strapi: Strapi }) => {
|
|
|
33
33
|
populate: '*'
|
|
34
34
|
})) as Record<string, any>[];
|
|
35
35
|
|
|
36
|
-
// checks which
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
// checks which roles the user has
|
|
37
|
+
const foundRoles = roles.filter((role) => x.roles.find((userRole) => userRole.name === role.name));
|
|
38
|
+
|
|
39
|
+
// Get all permissions from the roles the user has
|
|
40
|
+
const allPermissions = [foundRoles?.[0]]
|
|
41
|
+
.map((role) => role?.permissions)
|
|
42
|
+
.flat()
|
|
43
|
+
.filter(Boolean);
|
|
40
44
|
|
|
41
45
|
// get the right platform permissions, and filters out the platform
|
|
42
46
|
// this is neccesary because of multiple platforms. if you can see Vacancy from platform 1 and collegue from platform 2
|
|
43
47
|
// it will show both at page level, so this filters out the wrong page
|
|
44
|
-
const platformPermission =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
48
|
+
const platformPermission = allPermissions.map((permission) => ({
|
|
49
|
+
subject: permission.subject,
|
|
50
|
+
conditions: permission?.conditions.filter((condition) => condition.includes(platform.title))
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
// Get the right permission for platform
|
|
54
|
+
const permissions = platformPermission
|
|
55
|
+
.map((permission) => {
|
|
56
|
+
if (permission.conditions.length > 0) {
|
|
57
|
+
return permission.subject;
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
.filter(Boolean);
|
|
57
61
|
|
|
58
62
|
const uniquePermissions = uniq(permissions);
|
|
59
63
|
|
package/server/bootstrap.ts
CHANGED
|
@@ -36,23 +36,32 @@ export default async ({ strapi }: { strapi: Strapi }) => {
|
|
|
36
36
|
models: [USER_PERMISSION_USER_PLUGIN],
|
|
37
37
|
async beforeUpdate(event) {
|
|
38
38
|
if (event.params.data.id) {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
await strapi.service(PAGE_BUILDER_EMAIL_PLUGIN).sendMail({
|
|
45
|
-
// @ts-ignore strapi typings
|
|
46
|
-
from: userToUpdate.platform.platformEmails.accountAcceptedMail.fromEmail,
|
|
47
|
-
to: event.params.data.email,
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
subject: userToUpdate.platform.platformEmails.accountAcceptedMail.subject,
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
text: userToUpdate.platform.platformEmails.accountAcceptedMail.message,
|
|
52
|
-
firstName: event.params.data.firstName,
|
|
53
|
-
lastName: event.params.data.lastName
|
|
54
|
-
});
|
|
39
|
+
const originalUserObject = await strapi.entityService?.findOne(
|
|
40
|
+
USER_PERMISSION_USER_PLUGIN,
|
|
41
|
+
event.params.data.id,
|
|
42
|
+
{
|
|
43
|
+
populate: { platform: { populate: { platformEmails: { populate: '*' } } } }
|
|
55
44
|
}
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
if (
|
|
48
|
+
originalUserObject &&
|
|
49
|
+
event.params.data.activateUser &&
|
|
50
|
+
event.params.data.confirmed &&
|
|
51
|
+
!originalUserObject.confirmMailSend
|
|
52
|
+
) {
|
|
53
|
+
await strapi.service(PAGE_BUILDER_EMAIL_PLUGIN).sendMail({
|
|
54
|
+
// @ts-ignore strapi typings
|
|
55
|
+
from: originalUserObject.platform.platformEmails.accountAcceptedMail.fromEmail,
|
|
56
|
+
to: event.params.data.email,
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
subject: originalUserObject.platform.platformEmails.accountAcceptedMail.subject,
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
text: originalUserObject.platform.platformEmails.accountAcceptedMail.message,
|
|
61
|
+
firstName: event.params.data.firstName,
|
|
62
|
+
lastName: event.params.data.lastName
|
|
63
|
+
});
|
|
64
|
+
event.params.data.confirmMailSend = true;
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
67
|
}
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
const callbackUrl = `${user.platform.domain}/inloggen`;
|
|
8
8
|
return ctx.redirect(callbackUrl);
|
|
9
9
|
} catch (error) {
|
|
10
|
-
console.log(ctx);
|
|
10
|
+
console.log('Activate User Error', error, ctx);
|
|
11
11
|
return ctx.unauthorized('User is already confirmed or token is invalid');
|
|
12
12
|
}
|
|
13
13
|
},
|
package/server/services/email.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as AWS from '@aws-sdk/client-ses';
|
|
2
2
|
import { txtEmail } from './private-content/mail-template/txtMail.email.template.text';
|
|
3
3
|
import { USER_PERMISSION_USER_PLUGIN } from '../../shared/utils/constants';
|
|
4
|
+
import { errors } from '@strapi/utils';
|
|
4
5
|
|
|
5
6
|
interface SendOptions {
|
|
6
7
|
from: string;
|
|
@@ -32,6 +33,7 @@ export default {
|
|
|
32
33
|
});
|
|
33
34
|
} catch (error) {
|
|
34
35
|
console.error(error);
|
|
36
|
+
throw new errors.ApplicationError('Failed to send email', error);
|
|
35
37
|
}
|
|
36
38
|
},
|
|
37
39
|
async sendAdminMail(user) {
|