bruce-models 4.5.1 → 4.5.3

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.
@@ -120,6 +120,11 @@ var Api;
120
120
  ESortOrder[ESortOrder["Asc"] = 1] = "Asc";
121
121
  ESortOrder[ESortOrder["Desc"] = -1] = "Desc";
122
122
  })(ESortOrder = Api.ESortOrder || (Api.ESortOrder = {}));
123
+ let ESortOrderStr;
124
+ (function (ESortOrderStr) {
125
+ ESortOrderStr["Asc"] = "ASC";
126
+ ESortOrderStr["Desc"] = "DESC";
127
+ })(ESortOrderStr = Api.ESortOrderStr || (Api.ESortOrderStr = {}));
123
128
  /**
124
129
  * Known response encodings from Nextspace APIs.
125
130
  */
@@ -11000,14 +11005,37 @@ var Session;
11000
11005
  * @returns
11001
11006
  */
11002
11007
  function IsSuperPermEnabled(params) {
11003
- var _a, _b;
11008
+ var _a, _b, _c, _d;
11004
11009
  let { session, perm } = params;
11005
11010
  if (!perm) {
11006
11011
  throw ("Perm is required.");
11007
11012
  }
11013
+ if (!session) {
11014
+ return false;
11015
+ }
11008
11016
  perm = perm.toLocaleUpperCase();
11009
- const accessPerms = (_b = (_a = session === null || session === void 0 ? void 0 : session.HypeportalAccessPermisssions) === null || _a === void 0 ? void 0 : _a.EnabledFeatures) !== null && _b !== void 0 ? _b : [];
11010
- return accessPerms.findIndex(x => x.toLocaleUpperCase() == perm) > -1;
11017
+ // We'll look for 'HypeportalAccessPermisssions' first.
11018
+ if ((_a = session.HypeportalAccessPermisssions) === null || _a === void 0 ? void 0 : _a.EnabledFeatures) {
11019
+ const perms = session.HypeportalAccessPermisssions.EnabledFeatures;
11020
+ return perms.findIndex(x => x.toLocaleUpperCase() == perm) > -1;
11021
+ }
11022
+ // Fallback to looking through groups.
11023
+ // This is important if the user directly logged into "hypeportal" as the response differs.
11024
+ else if ((_c = (_b = session.User) === null || _b === void 0 ? void 0 : _b.AccessPermissions) === null || _c === void 0 ? void 0 : _c.length) {
11025
+ const perms = session.User.AccessPermissions.find(x => String(x["ClientAccount.ID"]).toLowerCase() == "hypeportal");
11026
+ if ((_d = perms === null || perms === void 0 ? void 0 : perms.UserGroups) === null || _d === void 0 ? void 0 : _d.length) {
11027
+ for (let j = 0; j < perms.UserGroups.length; j++) {
11028
+ const group = perms.UserGroups[j];
11029
+ if (typeof group != "string") {
11030
+ const features = group.Features;
11031
+ if (features && features.findIndex(x => x.toLocaleUpperCase() == perm) > -1) {
11032
+ return true;
11033
+ }
11034
+ }
11035
+ }
11036
+ }
11037
+ }
11038
+ return false;
11011
11039
  }
11012
11040
  Session.IsSuperPermEnabled = IsSuperPermEnabled;
11013
11041
  /**
@@ -13658,7 +13686,7 @@ var DataSource;
13658
13686
  })(DataSource || (DataSource = {}));
13659
13687
 
13660
13688
  // This is updated with the package.json version on build.
13661
- const VERSION = "4.5.1";
13689
+ const VERSION = "4.5.3";
13662
13690
 
13663
13691
  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 };
13664
13692
  //# sourceMappingURL=bruce-models.es5.js.map