@budibase/frontend-core 2.3.18-alpha.16 → 2.3.18-alpha.17
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 +3 -3
- package/src/api/user.js +50 -2
- package/src/fetch/UserFetch.js +1 -0
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "2.3.18-alpha.
|
|
3
|
+
"version": "2.3.18-alpha.17",
|
|
4
4
|
"description": "Budibase frontend core libraries used in builder and client",
|
|
5
5
|
"author": "Budibase",
|
|
6
6
|
"license": "MPL-2.0",
|
|
7
7
|
"svelte": "src/index.js",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@budibase/bbui": "2.3.18-alpha.
|
|
9
|
+
"@budibase/bbui": "2.3.18-alpha.17",
|
|
10
10
|
"lodash": "^4.17.21",
|
|
11
11
|
"svelte": "^3.46.2"
|
|
12
12
|
},
|
|
13
|
-
"gitHead": "
|
|
13
|
+
"gitHead": "f703ebb73409290aa949c240c51b95c7ce3826c8"
|
|
14
14
|
}
|
package/src/api/user.js
CHANGED
|
@@ -12,8 +12,10 @@ export const buildUserEndpoints = API => ({
|
|
|
12
12
|
* Gets a list of users in the current tenant.
|
|
13
13
|
* @param {string} page The page to retrieve
|
|
14
14
|
* @param {string} search The starts with string to search username/email by.
|
|
15
|
+
* @param {string} appId Facilitate app/role based user searching
|
|
16
|
+
* @param {boolean} paginated Allow the disabling of pagination
|
|
15
17
|
*/
|
|
16
|
-
searchUsers: async ({ page, email, appId } = {}) => {
|
|
18
|
+
searchUsers: async ({ paginated, page, email, appId } = {}) => {
|
|
17
19
|
const opts = {}
|
|
18
20
|
if (page) {
|
|
19
21
|
opts.page = page
|
|
@@ -24,6 +26,9 @@ export const buildUserEndpoints = API => ({
|
|
|
24
26
|
if (appId) {
|
|
25
27
|
opts.appId = appId
|
|
26
28
|
}
|
|
29
|
+
if (typeof paginated === "boolean") {
|
|
30
|
+
opts.paginated = paginated
|
|
31
|
+
}
|
|
27
32
|
return await API.post({
|
|
28
33
|
url: `/api/global/users/search`,
|
|
29
34
|
body: opts,
|
|
@@ -133,7 +138,7 @@ export const buildUserEndpoints = API => ({
|
|
|
133
138
|
* @param builder whether the user should be a global builder
|
|
134
139
|
* @param admin whether the user should be a global admin
|
|
135
140
|
*/
|
|
136
|
-
inviteUser: async ({ email, builder, admin }) => {
|
|
141
|
+
inviteUser: async ({ email, builder, admin, apps }) => {
|
|
137
142
|
return await API.post({
|
|
138
143
|
url: "/api/global/users/invite",
|
|
139
144
|
body: {
|
|
@@ -141,11 +146,43 @@ export const buildUserEndpoints = API => ({
|
|
|
141
146
|
userInfo: {
|
|
142
147
|
admin: admin ? { global: true } : undefined,
|
|
143
148
|
builder: builder ? { global: true } : undefined,
|
|
149
|
+
apps: apps ? apps : undefined,
|
|
144
150
|
},
|
|
145
151
|
},
|
|
146
152
|
})
|
|
147
153
|
},
|
|
148
154
|
|
|
155
|
+
onboardUsers: async payload => {
|
|
156
|
+
return await API.post({
|
|
157
|
+
url: "/api/global/users/onboard",
|
|
158
|
+
body: payload.map(invite => {
|
|
159
|
+
const { email, admin, builder, apps } = invite
|
|
160
|
+
return {
|
|
161
|
+
email,
|
|
162
|
+
userInfo: {
|
|
163
|
+
admin: admin ? { global: true } : undefined,
|
|
164
|
+
builder: builder ? { global: true } : undefined,
|
|
165
|
+
apps: apps ? apps : undefined,
|
|
166
|
+
},
|
|
167
|
+
}
|
|
168
|
+
}),
|
|
169
|
+
})
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Accepts a user invite as a body and will update the associated app roles.
|
|
174
|
+
* for an existing invite
|
|
175
|
+
* @param invite the invite code sent in the email
|
|
176
|
+
*/
|
|
177
|
+
updateUserInvite: async invite => {
|
|
178
|
+
await API.post({
|
|
179
|
+
url: `/api/global/users/invite/update/${invite.code}`,
|
|
180
|
+
body: {
|
|
181
|
+
apps: invite.apps,
|
|
182
|
+
},
|
|
183
|
+
})
|
|
184
|
+
},
|
|
185
|
+
|
|
149
186
|
/**
|
|
150
187
|
* Retrieves the invitation associated with a provided code.
|
|
151
188
|
* @param code The unique code for the target invite
|
|
@@ -156,6 +193,16 @@ export const buildUserEndpoints = API => ({
|
|
|
156
193
|
})
|
|
157
194
|
},
|
|
158
195
|
|
|
196
|
+
/**
|
|
197
|
+
* Retrieves the invitation associated with a provided code.
|
|
198
|
+
* @param code The unique code for the target invite
|
|
199
|
+
*/
|
|
200
|
+
getUserInvites: async () => {
|
|
201
|
+
return await API.get({
|
|
202
|
+
url: `/api/global/users/invites`,
|
|
203
|
+
})
|
|
204
|
+
},
|
|
205
|
+
|
|
159
206
|
/**
|
|
160
207
|
* Invites multiple users to the current tenant.
|
|
161
208
|
* @param users An array of users to invite
|
|
@@ -169,6 +216,7 @@ export const buildUserEndpoints = API => ({
|
|
|
169
216
|
admin: user.admin ? { global: true } : undefined,
|
|
170
217
|
builder: user.admin || user.builder ? { global: true } : undefined,
|
|
171
218
|
userGroups: user.groups,
|
|
219
|
+
roles: user.apps ? user.apps : undefined,
|
|
172
220
|
},
|
|
173
221
|
})),
|
|
174
222
|
})
|