bruce-models 4.5.2 → 4.5.4
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 +75 -30
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +75 -30
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/api.js +6 -0
- package/dist/lib/api/api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/data-lab/data-lab.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 +5 -0
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/data-lab/data-lab.d.ts +2 -0
- 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
|
/**
|
|
@@ -120,6 +121,11 @@ var Api;
|
|
|
120
121
|
ESortOrder[ESortOrder["Asc"] = 1] = "Asc";
|
|
121
122
|
ESortOrder[ESortOrder["Desc"] = -1] = "Desc";
|
|
122
123
|
})(ESortOrder = Api.ESortOrder || (Api.ESortOrder = {}));
|
|
124
|
+
let ESortOrderStr;
|
|
125
|
+
(function (ESortOrderStr) {
|
|
126
|
+
ESortOrderStr["Asc"] = "ASC";
|
|
127
|
+
ESortOrderStr["Desc"] = "DESC";
|
|
128
|
+
})(ESortOrderStr = Api.ESortOrderStr || (Api.ESortOrderStr = {}));
|
|
123
129
|
/**
|
|
124
130
|
* Known response encodings from Nextspace APIs.
|
|
125
131
|
*/
|
|
@@ -10967,27 +10973,53 @@ var Session;
|
|
|
10967
10973
|
* @returns
|
|
10968
10974
|
*/
|
|
10969
10975
|
function IsPermEnabled(params) {
|
|
10970
|
-
var _a, _b;
|
|
10976
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10971
10977
|
let { session, accountId, perm } = params;
|
|
10972
10978
|
if (!perm) {
|
|
10973
10979
|
throw ("Perm is required.");
|
|
10974
10980
|
}
|
|
10975
10981
|
perm = perm.toLocaleUpperCase();
|
|
10976
|
-
|
|
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;
|
|
10977
11014
|
if (!perms) {
|
|
10978
11015
|
return false;
|
|
10979
11016
|
}
|
|
10980
|
-
|
|
10981
|
-
|
|
11017
|
+
const pAccountId = String(perms["ClientAccount.ID"]).toLowerCase();
|
|
11018
|
+
if (pAccountId != accountId) {
|
|
11019
|
+
return false;
|
|
10982
11020
|
}
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
if (typeof group != "string") {
|
|
10986
|
-
const features = group.Features;
|
|
10987
|
-
if (features && features.findIndex(x => x.toLocaleUpperCase() == perm) > -1) {
|
|
10988
|
-
return true;
|
|
10989
|
-
}
|
|
10990
|
-
}
|
|
11021
|
+
if ((_f = perms.EnabledFeatures) === null || _f === void 0 ? void 0 : _f.length) {
|
|
11022
|
+
return perms.EnabledFeatures.findIndex(x => x.toLocaleUpperCase() == perm) > -1;
|
|
10991
11023
|
}
|
|
10992
11024
|
return false;
|
|
10993
11025
|
}
|
|
@@ -11009,22 +11041,35 @@ var Session;
|
|
|
11009
11041
|
return false;
|
|
11010
11042
|
}
|
|
11011
11043
|
perm = perm.toLocaleUpperCase();
|
|
11012
|
-
//
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
return
|
|
11016
|
-
}
|
|
11017
|
-
//
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11023
|
-
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
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
|
+
}
|
|
11028
11073
|
}
|
|
11029
11074
|
}
|
|
11030
11075
|
}
|
|
@@ -11297,7 +11342,7 @@ var User;
|
|
|
11297
11342
|
if ((_a = data.AccessPermissions) === null || _a === void 0 ? void 0 : _a.length) {
|
|
11298
11343
|
for (let i = 0; i < data.AccessPermissions.length; i++) {
|
|
11299
11344
|
const perm = data.AccessPermissions[i];
|
|
11300
|
-
if (!perm["UserGroup.ID"] && perm.UserGroups) {
|
|
11345
|
+
if (!perm["UserGroup.ID"] && perm.UserGroups && typeof perm.UserGroups != "string") {
|
|
11301
11346
|
perm["UserGroup.ID"] = [];
|
|
11302
11347
|
for (let j = 0; j < perm.UserGroups.length; j++) {
|
|
11303
11348
|
perm["UserGroup.ID"].push(perm.UserGroups[j].ID);
|
|
@@ -13681,7 +13726,7 @@ var DataSource;
|
|
|
13681
13726
|
})(DataSource || (DataSource = {}));
|
|
13682
13727
|
|
|
13683
13728
|
// This is updated with the package.json version on build.
|
|
13684
|
-
const VERSION = "4.5.
|
|
13729
|
+
const VERSION = "4.5.4";
|
|
13685
13730
|
|
|
13686
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 };
|
|
13687
13732
|
//# sourceMappingURL=bruce-models.es5.js.map
|