@budibase/worker 3.27.4 → 3.27.5
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/worker",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "3.27.
|
|
4
|
+
"version": "3.27.5",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "46316dfbbf8e41a547bc8a4977ccd819a7515b9a"
|
|
111
111
|
}
|
|
@@ -589,11 +589,12 @@ export const inviteMultiple = async (
|
|
|
589
589
|
export const removeMultipleInvites = async (
|
|
590
590
|
ctx: Ctx<DeleteInviteUsersRequest, DeleteInviteUsersResponse>
|
|
591
591
|
) => {
|
|
592
|
+
const tenantId = context.getTenantId()
|
|
592
593
|
const inviteCodesToRemove = ctx.request.body.map(
|
|
593
594
|
(invite: DeleteInviteUserRequest) => invite.code
|
|
594
595
|
)
|
|
595
596
|
for (const code of inviteCodesToRemove) {
|
|
596
|
-
await cache.invite.deleteCode(code)
|
|
597
|
+
await cache.invite.deleteCode(code, tenantId)
|
|
597
598
|
}
|
|
598
599
|
ctx.body = {
|
|
599
600
|
message: "User invites successfully removed.",
|
|
@@ -602,9 +603,13 @@ export const removeMultipleInvites = async (
|
|
|
602
603
|
|
|
603
604
|
export const checkInvite = async (ctx: UserCtx<void, CheckInviteResponse>) => {
|
|
604
605
|
const { code } = ctx.params
|
|
606
|
+
const tenantId =
|
|
607
|
+
typeof ctx.request.query.tenantId === "string"
|
|
608
|
+
? ctx.request.query.tenantId
|
|
609
|
+
: undefined
|
|
605
610
|
let invite
|
|
606
611
|
try {
|
|
607
|
-
invite = await cache.invite.getCode(code)
|
|
612
|
+
invite = await cache.invite.getCode(code, tenantId)
|
|
608
613
|
} catch (e) {
|
|
609
614
|
console.warn("Error getting invite from code", e)
|
|
610
615
|
ctx.throw(400, "There was a problem with the invite")
|
|
@@ -637,7 +642,8 @@ export const addWorkspaceIdToInvite = async (
|
|
|
637
642
|
const prodWorkspaceId = db.getProdWorkspaceID(workspaceId)
|
|
638
643
|
|
|
639
644
|
try {
|
|
640
|
-
const
|
|
645
|
+
const tenantId = context.getTenantId()
|
|
646
|
+
const invite = await cache.invite.getCode(code, tenantId)
|
|
641
647
|
invite.info.apps ??= {}
|
|
642
648
|
invite.info.apps[prodWorkspaceId] = role
|
|
643
649
|
|
|
@@ -660,7 +666,8 @@ export const removeWorkspaceIdFromInvite = async (
|
|
|
660
666
|
const prodWorkspaceId = db.getProdWorkspaceID(workspaceId)
|
|
661
667
|
|
|
662
668
|
try {
|
|
663
|
-
const
|
|
669
|
+
const tenantId = context.getTenantId()
|
|
670
|
+
const invite = await cache.invite.getCode(code, tenantId)
|
|
664
671
|
invite.info.apps ??= {}
|
|
665
672
|
delete invite.info.apps[prodWorkspaceId]
|
|
666
673
|
|
|
@@ -674,7 +681,13 @@ export const removeWorkspaceIdFromInvite = async (
|
|
|
674
681
|
export const inviteAccept = async (
|
|
675
682
|
ctx: Ctx<AcceptUserInviteRequest, AcceptUserInviteResponse>
|
|
676
683
|
) => {
|
|
677
|
-
const { inviteCode, password, firstName, lastName } =
|
|
684
|
+
const { inviteCode, password, firstName, lastName, tenantId } =
|
|
685
|
+
ctx.request.body
|
|
686
|
+
const queryTenantId =
|
|
687
|
+
typeof ctx.request.query.tenantId === "string"
|
|
688
|
+
? ctx.request.query.tenantId
|
|
689
|
+
: undefined
|
|
690
|
+
const resolvedTenantId = tenantId || queryTenantId
|
|
678
691
|
try {
|
|
679
692
|
await locks.doWithLock(
|
|
680
693
|
{
|
|
@@ -685,7 +698,10 @@ export const inviteAccept = async (
|
|
|
685
698
|
},
|
|
686
699
|
async () => {
|
|
687
700
|
// info is an extension of the user object that was stored by global
|
|
688
|
-
const { email, info } = await cache.invite.getCode(
|
|
701
|
+
const { email, info } = await cache.invite.getCode(
|
|
702
|
+
inviteCode,
|
|
703
|
+
resolvedTenantId
|
|
704
|
+
)
|
|
689
705
|
const user = await tenancy.doInTenant(info.tenantId, async () => {
|
|
690
706
|
let request: any = {
|
|
691
707
|
firstName,
|
|
@@ -715,7 +731,7 @@ export const inviteAccept = async (
|
|
|
715
731
|
return saved
|
|
716
732
|
})
|
|
717
733
|
|
|
718
|
-
await cache.invite.deleteCode(inviteCode)
|
|
734
|
+
await cache.invite.deleteCode(inviteCode, resolvedTenantId)
|
|
719
735
|
|
|
720
736
|
// make sure onboarding flow is cleared
|
|
721
737
|
ctx.cookies.set(BpmStatusKey.ONBOARDING, BpmStatusValue.COMPLETED, {
|