@budibase/shared-core 2.13.15 → 2.13.16
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/dist/index.js +14 -3
- package/dist/index.js.map +2 -2
- package/dist/index.js.meta.json +1 -1
- package/dist/sdk/documents/users.d.ts +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5288,12 +5288,14 @@ function getProdAppID(appId) {
|
|
|
5288
5288
|
// src/sdk/documents/users.ts
|
|
5289
5289
|
var users_exports = {};
|
|
5290
5290
|
__export(users_exports, {
|
|
5291
|
+
canCreateApps: () => canCreateApps,
|
|
5291
5292
|
containsUserID: () => containsUserID,
|
|
5292
5293
|
getGlobalUserID: () => getGlobalUserID,
|
|
5293
5294
|
hasAdminPermissions: () => hasAdminPermissions,
|
|
5294
5295
|
hasAppBuilderPermissions: () => hasAppBuilderPermissions,
|
|
5295
5296
|
hasAppCreatorPermissions: () => hasAppCreatorPermissions,
|
|
5296
5297
|
hasBuilderPermissions: () => hasBuilderPermissions,
|
|
5298
|
+
hasCreatorPermissions: () => hasCreatorPermissions,
|
|
5297
5299
|
isAdmin: () => isAdmin,
|
|
5298
5300
|
isAdminOrBuilder: () => isAdminOrBuilder,
|
|
5299
5301
|
isAdminOrGlobalBuilder: () => isAdminOrGlobalBuilder,
|
|
@@ -5316,6 +5318,9 @@ function isBuilder(user, appId) {
|
|
|
5316
5318
|
function isGlobalBuilder(user) {
|
|
5317
5319
|
return isBuilder(user) && !hasAppBuilderPermissions(user) || isAdmin(user);
|
|
5318
5320
|
}
|
|
5321
|
+
function canCreateApps(user) {
|
|
5322
|
+
return isGlobalBuilder(user) || hasCreatorPermissions(user);
|
|
5323
|
+
}
|
|
5319
5324
|
function isAdmin(user) {
|
|
5320
5325
|
if (!user) {
|
|
5321
5326
|
return false;
|
|
@@ -5343,7 +5348,7 @@ function hasAppCreatorPermissions(user) {
|
|
|
5343
5348
|
return _.flow(
|
|
5344
5349
|
_.get("roles"),
|
|
5345
5350
|
_.values,
|
|
5346
|
-
_.find((x) =>
|
|
5351
|
+
_.find((x) => x === "CREATOR"),
|
|
5347
5352
|
(x) => !!x
|
|
5348
5353
|
)(user);
|
|
5349
5354
|
}
|
|
@@ -5351,7 +5356,7 @@ function hasBuilderPermissions(user) {
|
|
|
5351
5356
|
if (!user) {
|
|
5352
5357
|
return false;
|
|
5353
5358
|
}
|
|
5354
|
-
return user.builder?.global || hasAppBuilderPermissions(user);
|
|
5359
|
+
return user.builder?.global || hasAppBuilderPermissions(user) || hasCreatorPermissions(user);
|
|
5355
5360
|
}
|
|
5356
5361
|
function hasAdminPermissions(user) {
|
|
5357
5362
|
if (!user) {
|
|
@@ -5359,11 +5364,17 @@ function hasAdminPermissions(user) {
|
|
|
5359
5364
|
}
|
|
5360
5365
|
return !!user.admin?.global;
|
|
5361
5366
|
}
|
|
5367
|
+
function hasCreatorPermissions(user) {
|
|
5368
|
+
if (!user) {
|
|
5369
|
+
return false;
|
|
5370
|
+
}
|
|
5371
|
+
return !!user.builder?.creator;
|
|
5372
|
+
}
|
|
5362
5373
|
function isCreator(user) {
|
|
5363
5374
|
if (!user) {
|
|
5364
5375
|
return false;
|
|
5365
5376
|
}
|
|
5366
|
-
return isGlobalBuilder(user) || hasAdminPermissions(user) || hasAppBuilderPermissions(user) || hasAppCreatorPermissions(user);
|
|
5377
|
+
return isGlobalBuilder(user) || hasAdminPermissions(user) || hasCreatorPermissions(user) || hasAppBuilderPermissions(user) || hasAppCreatorPermissions(user);
|
|
5367
5378
|
}
|
|
5368
5379
|
function getGlobalUserID(userId) {
|
|
5369
5380
|
if (typeof userId !== "string") {
|