bruce-models 4.5.3 → 4.5.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/dist/bruce-models.es5.js +70 -30
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +70 -30
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/api.js +1 -0
- package/dist/lib/api/api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/entity/entity-table-view.js.map +1 -1
- package/dist/lib/user/session.js +66 -27
- package/dist/lib/user/session.js.map +1 -1
- package/dist/lib/user/user.js +1 -1
- package/dist/lib/user/user.js.map +1 -1
- package/dist/types/api/api.d.ts +1 -0
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/entity/entity-table-view.d.ts +5 -3
- package/dist/types/user/session.d.ts +3 -2
- package/dist/types/user/user.d.ts +2 -1
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -85,6 +85,7 @@ var Api;
|
|
|
85
85
|
Api.DEFAULT_CACHE_DURATION = 60 * 1000;
|
|
86
86
|
// The template client account is a container for default settings to reference.
|
|
87
87
|
Api.TEMPLATE_ACCOUNT_ID = "template";
|
|
88
|
+
Api.SUPER_ACCOUNT_ID = "hypeportal";
|
|
88
89
|
// Default session token header.
|
|
89
90
|
Api.ACCESS_TOKEN_HEADER = "X-Access-Token";
|
|
90
91
|
/**
|
|
@@ -10972,27 +10973,53 @@ var Session;
|
|
|
10972
10973
|
* @returns
|
|
10973
10974
|
*/
|
|
10974
10975
|
function IsPermEnabled(params) {
|
|
10975
|
-
var _a, _b;
|
|
10976
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10976
10977
|
let { session, accountId, perm } = params;
|
|
10977
10978
|
if (!perm) {
|
|
10978
10979
|
throw ("Perm is required.");
|
|
10979
10980
|
}
|
|
10980
10981
|
perm = perm.toLocaleUpperCase();
|
|
10981
|
-
|
|
10982
|
+
accountId = accountId.toLowerCase();
|
|
10983
|
+
// First we'll scan the user object for the account ID.
|
|
10984
|
+
if ((_b = (_a = session === null || session === void 0 ? void 0 : session.User) === null || _a === void 0 ? void 0 : _a.AccessPermissions) === null || _b === void 0 ? void 0 : _b.length) {
|
|
10985
|
+
for (let i = 0; i < session.User.AccessPermissions.length; i++) {
|
|
10986
|
+
const aPerms = session.User.AccessPermissions[i];
|
|
10987
|
+
const permsAccountId = String(aPerms["ClientAccount.ID"]).toLowerCase();
|
|
10988
|
+
// Found account, woo.
|
|
10989
|
+
if (permsAccountId == accountId) {
|
|
10990
|
+
// Check against the loaded perm array.
|
|
10991
|
+
// In newer version this always exists, but in some legacy versions it MIGHT not,
|
|
10992
|
+
//therefor we also do a group check after..
|
|
10993
|
+
if ((_c = aPerms.EnabledFeatures) === null || _c === void 0 ? void 0 : _c.length) {
|
|
10994
|
+
return aPerms.EnabledFeatures.findIndex(x => x.toLocaleUpperCase() == perm) > -1;
|
|
10995
|
+
}
|
|
10996
|
+
// Fallback to group check.
|
|
10997
|
+
if (((_d = aPerms.UserGroups) === null || _d === void 0 ? void 0 : _d.length) && typeof aPerms.UserGroups[0] != "string") {
|
|
10998
|
+
for (let j = 0; j < aPerms.UserGroups.length; j++) {
|
|
10999
|
+
const group = aPerms.UserGroups[j];
|
|
11000
|
+
if ((_e = group === null || group === void 0 ? void 0 : group.Features) === null || _e === void 0 ? void 0 : _e.length) {
|
|
11001
|
+
const gPerms = group.Features;
|
|
11002
|
+
if (gPerms && gPerms.findIndex(x => x.toLocaleUpperCase() == perm) > -1) {
|
|
11003
|
+
return true;
|
|
11004
|
+
}
|
|
11005
|
+
}
|
|
11006
|
+
}
|
|
11007
|
+
}
|
|
11008
|
+
}
|
|
11009
|
+
}
|
|
11010
|
+
}
|
|
11011
|
+
// Fallback to the session perm info.
|
|
11012
|
+
// This is deprecated and old as it's only for one account.
|
|
11013
|
+
const perms = session === null || session === void 0 ? void 0 : session.AccessPermissions;
|
|
10982
11014
|
if (!perms) {
|
|
10983
11015
|
return false;
|
|
10984
11016
|
}
|
|
10985
|
-
|
|
10986
|
-
|
|
11017
|
+
const pAccountId = String(perms["ClientAccount.ID"]).toLowerCase();
|
|
11018
|
+
if (pAccountId != accountId) {
|
|
11019
|
+
return false;
|
|
10987
11020
|
}
|
|
10988
|
-
|
|
10989
|
-
|
|
10990
|
-
if (typeof group != "string") {
|
|
10991
|
-
const features = group.Features;
|
|
10992
|
-
if (features && features.findIndex(x => x.toLocaleUpperCase() == perm) > -1) {
|
|
10993
|
-
return true;
|
|
10994
|
-
}
|
|
10995
|
-
}
|
|
11021
|
+
if ((_f = perms.EnabledFeatures) === null || _f === void 0 ? void 0 : _f.length) {
|
|
11022
|
+
return perms.EnabledFeatures.findIndex(x => x.toLocaleUpperCase() == perm) > -1;
|
|
10996
11023
|
}
|
|
10997
11024
|
return false;
|
|
10998
11025
|
}
|
|
@@ -11014,22 +11041,35 @@ var Session;
|
|
|
11014
11041
|
return false;
|
|
11015
11042
|
}
|
|
11016
11043
|
perm = perm.toLocaleUpperCase();
|
|
11017
|
-
//
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
return
|
|
11021
|
-
}
|
|
11022
|
-
//
|
|
11023
|
-
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11044
|
+
// First we'll scan the included super perms.
|
|
11045
|
+
const superPerms = session.HypeportalAccessPermisssions;
|
|
11046
|
+
if ((_a = superPerms === null || superPerms === void 0 ? void 0 : superPerms.EnabledFeatures) === null || _a === void 0 ? void 0 : _a.length) {
|
|
11047
|
+
return superPerms.EnabledFeatures.findIndex(x => x.toLocaleUpperCase() == perm) > -1;
|
|
11048
|
+
}
|
|
11049
|
+
// Now we'll fallback to digging through group to find the super group.
|
|
11050
|
+
if ((_c = (_b = session === null || session === void 0 ? void 0 : session.User) === null || _b === void 0 ? void 0 : _b.AccessPermissions) === null || _c === void 0 ? void 0 : _c.length) {
|
|
11051
|
+
for (let i = 0; i < session.User.AccessPermissions.length; i++) {
|
|
11052
|
+
const perms = session.User.AccessPermissions[i];
|
|
11053
|
+
// Newer API versions always specify accountId in the collections.
|
|
11054
|
+
// If it's set we can do a super account check early.
|
|
11055
|
+
if (perms["ClientAccount.ID"] != null) {
|
|
11056
|
+
const pAccountId = String(perms["ClientAccount.ID"]).toLowerCase();
|
|
11057
|
+
if (pAccountId != Api.SUPER_ACCOUNT_ID) {
|
|
11058
|
+
continue;
|
|
11059
|
+
}
|
|
11060
|
+
}
|
|
11061
|
+
if ((_d = perms === null || perms === void 0 ? void 0 : perms.UserGroups) === null || _d === void 0 ? void 0 : _d.length) {
|
|
11062
|
+
for (let j = 0; j < perms.UserGroups.length; j++) {
|
|
11063
|
+
const group = perms.UserGroups[j];
|
|
11064
|
+
if (typeof group != "string") {
|
|
11065
|
+
const gAccountId = String(group["ClientAccount.ID"]).toLowerCase();
|
|
11066
|
+
if (gAccountId != Api.SUPER_ACCOUNT_ID) {
|
|
11067
|
+
continue;
|
|
11068
|
+
}
|
|
11069
|
+
const features = group.Features;
|
|
11070
|
+
if (features && features.findIndex(x => x.toLocaleUpperCase() == perm) > -1) {
|
|
11071
|
+
return true;
|
|
11072
|
+
}
|
|
11033
11073
|
}
|
|
11034
11074
|
}
|
|
11035
11075
|
}
|
|
@@ -11302,7 +11342,7 @@ var User;
|
|
|
11302
11342
|
if ((_a = data.AccessPermissions) === null || _a === void 0 ? void 0 : _a.length) {
|
|
11303
11343
|
for (let i = 0; i < data.AccessPermissions.length; i++) {
|
|
11304
11344
|
const perm = data.AccessPermissions[i];
|
|
11305
|
-
if (!perm["UserGroup.ID"] && perm.UserGroups) {
|
|
11345
|
+
if (!perm["UserGroup.ID"] && perm.UserGroups && typeof perm.UserGroups != "string") {
|
|
11306
11346
|
perm["UserGroup.ID"] = [];
|
|
11307
11347
|
for (let j = 0; j < perm.UserGroups.length; j++) {
|
|
11308
11348
|
perm["UserGroup.ID"].push(perm.UserGroups[j].ID);
|
|
@@ -13686,7 +13726,7 @@ var DataSource;
|
|
|
13686
13726
|
})(DataSource || (DataSource = {}));
|
|
13687
13727
|
|
|
13688
13728
|
// This is updated with the package.json version on build.
|
|
13689
|
-
const VERSION = "4.5.
|
|
13729
|
+
const VERSION = "4.5.5";
|
|
13690
13730
|
|
|
13691
13731
|
export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
|
|
13692
13732
|
//# sourceMappingURL=bruce-models.es5.js.map
|