@budibase/worker 3.2.32 → 3.2.33
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.2.
|
|
4
|
+
"version": "3.2.33",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "01b66a3805fd2720d5937b1d9cef62f997c1e15b"
|
|
118
118
|
}
|
|
@@ -84,15 +84,15 @@ export async function fetchAPIKey(ctx: UserCtx<void, FetchAPIKeyResponse>) {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
87
|
+
*
|
|
88
88
|
*/
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
89
|
+
const getUserSessionAttributes = (ctx: any) => ({
|
|
90
|
+
account: ctx.user.account,
|
|
91
|
+
license: ctx.user.license,
|
|
92
|
+
budibaseAccess: !!ctx.user.budibaseAccess,
|
|
93
|
+
accountPortalAccess: !!ctx.user.accountPortalAccess,
|
|
94
|
+
csrfToken: ctx.user.csrfToken,
|
|
95
|
+
})
|
|
96
96
|
|
|
97
97
|
export async function getSelf(ctx: UserCtx<void, GetGlobalSelfResponse>) {
|
|
98
98
|
if (!ctx.user) {
|
|
@@ -108,13 +108,19 @@ export async function getSelf(ctx: UserCtx<void, GetGlobalSelfResponse>) {
|
|
|
108
108
|
|
|
109
109
|
// get the main body of the user
|
|
110
110
|
const user = await userSdk.db.getUser(userId)
|
|
111
|
-
|
|
111
|
+
const enrichedUser = await groups.enrichUserRolesFromGroups(user)
|
|
112
|
+
|
|
113
|
+
// add the attributes that are session based to the current user
|
|
114
|
+
const sessionAttributes = getUserSessionAttributes(ctx)
|
|
112
115
|
|
|
113
116
|
// add the feature flags for this tenant
|
|
114
117
|
const flags = await features.flags.fetch()
|
|
115
|
-
ctx.body.flags = flags
|
|
116
118
|
|
|
117
|
-
|
|
119
|
+
ctx.body = {
|
|
120
|
+
...enrichedUser,
|
|
121
|
+
...sessionAttributes,
|
|
122
|
+
flags,
|
|
123
|
+
}
|
|
118
124
|
}
|
|
119
125
|
|
|
120
126
|
export const syncAppFavourites = async (processedAppIds: string[]) => {
|
|
@@ -72,12 +72,14 @@ export const save = async (ctx: UserCtx<User, SaveUserResponse>) => {
|
|
|
72
72
|
const requestUser = ctx.request.body
|
|
73
73
|
|
|
74
74
|
// Do not allow the account holder role to be changed
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
if (
|
|
76
|
+
requestUser.admin?.global !== true ||
|
|
77
|
+
requestUser.builder?.global !== true
|
|
78
|
+
) {
|
|
79
|
+
const accountMetadata = await users.getExistingAccounts([
|
|
80
|
+
requestUser.email,
|
|
81
|
+
])
|
|
82
|
+
if (accountMetadata?.length > 0) {
|
|
81
83
|
throw Error("Cannot set role of account holder")
|
|
82
84
|
}
|
|
83
85
|
}
|
|
@@ -441,7 +443,6 @@ export const checkInvite = async (ctx: UserCtx<void, CheckInviteResponse>) => {
|
|
|
441
443
|
} catch (e) {
|
|
442
444
|
console.warn("Error getting invite from code", e)
|
|
443
445
|
ctx.throw(400, "There was a problem with the invite")
|
|
444
|
-
return
|
|
445
446
|
}
|
|
446
447
|
ctx.body = {
|
|
447
448
|
email: invite.email,
|
|
@@ -472,7 +473,6 @@ export const updateInvite = async (
|
|
|
472
473
|
invite = await cache.invite.getCode(code)
|
|
473
474
|
} catch (e) {
|
|
474
475
|
ctx.throw(400, "There was a problem with the invite")
|
|
475
|
-
return
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
let updated = {
|