@7365admin1/core 3.64.5-staging.310 → 3.64.5-staging.311
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/.changeset/client-invite-modules-own-owner-role.md +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +48 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/e2e/client-invite-modules.e2e.test.mjs +164 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@7365admin1/core": minor
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Invite Client: Seven365 staff can choose a new client's modules (`modules` on `POST /api/auth/invite/user`, console `organizations` permission). Onboarding from that invitation stores the list on the organisation and records the save row that makes the module gate enforce it. A new-client invitation no longer carries a shared template role, so the owner holds the organisation's own seeded owner role.
|
package/dist/index.d.ts
CHANGED
|
@@ -11194,6 +11194,8 @@ type TVerificationMetadataV2 = {
|
|
|
11194
11194
|
invitedByName?: string;
|
|
11195
11195
|
/** True when the sender was a property management company — those need approval. */
|
|
11196
11196
|
invitedByPropertyManagement?: boolean;
|
|
11197
|
+
/** A new client's modules, chosen by Seven365 on Invite Client. */
|
|
11198
|
+
modules?: string[];
|
|
11197
11199
|
};
|
|
11198
11200
|
/**
|
|
11199
11201
|
* The one-time code an invitee types to prove they own the mailbox, held on the
|
package/dist/index.js
CHANGED
|
@@ -30081,7 +30081,9 @@ function useVerificationController() {
|
|
|
30081
30081
|
name: import_joi28.default.string().optional().allow("", null),
|
|
30082
30082
|
org: import_joi28.default.string().hex().optional().allow("", null),
|
|
30083
30083
|
siteId: import_joi28.default.string().hex().optional().allow("", null),
|
|
30084
|
-
siteName: import_joi28.default.string().optional().allow("", null)
|
|
30084
|
+
siteName: import_joi28.default.string().optional().allow("", null),
|
|
30085
|
+
// The modules Seven365 gives a NEW client (the console's Invite Client).
|
|
30086
|
+
modules: modulesSchema.optional()
|
|
30085
30087
|
});
|
|
30086
30088
|
const { error, value } = validation.validate(payload);
|
|
30087
30089
|
if (error) {
|
|
@@ -30096,12 +30098,24 @@ function useVerificationController() {
|
|
|
30096
30098
|
const {
|
|
30097
30099
|
email,
|
|
30098
30100
|
app,
|
|
30099
|
-
role,
|
|
30100
30101
|
name,
|
|
30101
30102
|
org,
|
|
30102
30103
|
siteId,
|
|
30103
|
-
siteName
|
|
30104
|
+
siteName,
|
|
30105
|
+
modules
|
|
30104
30106
|
} = value;
|
|
30107
|
+
const newClient = !org && !app.includes(PLATFORM_STAFF_MEMBER_TYPE);
|
|
30108
|
+
const role = newClient ? "" : value.role;
|
|
30109
|
+
let clientModules;
|
|
30110
|
+
if (modules !== void 0) {
|
|
30111
|
+
const invitedBy = await requireConsolePermission(req, "organizations");
|
|
30112
|
+
if (!newClient || app.length !== 1) {
|
|
30113
|
+
throw new import_node_server_utils66.BadRequestError(
|
|
30114
|
+
"Modules can only be chosen when inviting a new client, one application at a time."
|
|
30115
|
+
);
|
|
30116
|
+
}
|
|
30117
|
+
clientModules = { modules: normaliseModules(modules), invitedBy };
|
|
30118
|
+
}
|
|
30105
30119
|
await requireInviteReach(req, org, app, role);
|
|
30106
30120
|
const verificationIds = await _createSimpleUserInvite({
|
|
30107
30121
|
email,
|
|
@@ -30111,7 +30125,8 @@ function useVerificationController() {
|
|
|
30111
30125
|
name,
|
|
30112
30126
|
org,
|
|
30113
30127
|
siteId,
|
|
30114
|
-
siteName
|
|
30128
|
+
siteName,
|
|
30129
|
+
...clientModules
|
|
30115
30130
|
}
|
|
30116
30131
|
});
|
|
30117
30132
|
const responseBody = {
|
|
@@ -31899,6 +31914,7 @@ function useOrgController() {
|
|
|
31899
31914
|
let invitedFrom = null;
|
|
31900
31915
|
let invitedRole = null;
|
|
31901
31916
|
let inviteAlreadyComplete = false;
|
|
31917
|
+
let invitedModules = null;
|
|
31902
31918
|
let self = null;
|
|
31903
31919
|
if (inviteId) {
|
|
31904
31920
|
const [invite, caller] = await Promise.all([
|
|
@@ -31911,6 +31927,11 @@ function useOrgController() {
|
|
|
31911
31927
|
invitedFrom = String(invite._id);
|
|
31912
31928
|
invitedRole = invite.metadata?.role ? String(invite.metadata.role) : null;
|
|
31913
31929
|
inviteAlreadyComplete = invite.status === "complete" /* COMPLETE */;
|
|
31930
|
+
const chosen = normaliseModules(invite.metadata?.modules);
|
|
31931
|
+
const invitedBy = invite.metadata?.invitedBy;
|
|
31932
|
+
if (chosen.length && invitedBy && invite.metadata?.app === body.nature) {
|
|
31933
|
+
invitedModules = { modules: chosen, invitedBy: String(invitedBy) };
|
|
31934
|
+
}
|
|
31914
31935
|
} else {
|
|
31915
31936
|
import_node_server_utils71.logger.log({
|
|
31916
31937
|
level: "warn",
|
|
@@ -31926,7 +31947,29 @@ function useOrgController() {
|
|
|
31926
31947
|
);
|
|
31927
31948
|
}
|
|
31928
31949
|
}
|
|
31929
|
-
const _id = await _add({
|
|
31950
|
+
const _id = await _add({
|
|
31951
|
+
...body,
|
|
31952
|
+
createdBy,
|
|
31953
|
+
invitedFrom,
|
|
31954
|
+
invitedRole,
|
|
31955
|
+
...invitedModules && { modules: invitedModules.modules }
|
|
31956
|
+
});
|
|
31957
|
+
if (invitedModules) {
|
|
31958
|
+
await recordConsoleAction({
|
|
31959
|
+
action: "client.modules-changed" /* CLIENT_MODULES_CHANGED */,
|
|
31960
|
+
actor: invitedModules.invitedBy,
|
|
31961
|
+
org: String(_id),
|
|
31962
|
+
target: String(_id).toLowerCase(),
|
|
31963
|
+
targetType: "organization" /* ORGANIZATION */,
|
|
31964
|
+
after: pickAuditFields("client.modules-changed" /* CLIENT_MODULES_CHANGED */, {
|
|
31965
|
+
modules: invitedModules.modules.join(", "),
|
|
31966
|
+
moduleCount: invitedModules.modules.length,
|
|
31967
|
+
gateListHash: moduleListHash(invitedModules.modules),
|
|
31968
|
+
acknowledged: false,
|
|
31969
|
+
impactMemberCount: 0
|
|
31970
|
+
})
|
|
31971
|
+
});
|
|
31972
|
+
}
|
|
31930
31973
|
if (invitedFrom && !inviteAlreadyComplete) {
|
|
31931
31974
|
try {
|
|
31932
31975
|
await useVerificationRepoV2().updateStatusById(
|