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.
@@ -125,6 +125,11 @@
125
125
  ESortOrder[ESortOrder["Asc"] = 1] = "Asc";
126
126
  ESortOrder[ESortOrder["Desc"] = -1] = "Desc";
127
127
  })(ESortOrder = Api.ESortOrder || (Api.ESortOrder = {}));
128
+ let ESortOrderStr;
129
+ (function (ESortOrderStr) {
130
+ ESortOrderStr["Asc"] = "ASC";
131
+ ESortOrderStr["Desc"] = "DESC";
132
+ })(ESortOrderStr = Api.ESortOrderStr || (Api.ESortOrderStr = {}));
128
133
  /**
129
134
  * Known response encodings from Nextspace APIs.
130
135
  */
@@ -10777,14 +10782,37 @@
10777
10782
  * @returns
10778
10783
  */
10779
10784
  function IsSuperPermEnabled(params) {
10780
- var _a, _b;
10785
+ var _a, _b, _c, _d;
10781
10786
  let { session, perm } = params;
10782
10787
  if (!perm) {
10783
10788
  throw ("Perm is required.");
10784
10789
  }
10790
+ if (!session) {
10791
+ return false;
10792
+ }
10785
10793
  perm = perm.toLocaleUpperCase();
10786
- 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 : [];
10787
- return accessPerms.findIndex(x => x.toLocaleUpperCase() == perm) > -1;
10794
+ // We'll look for 'HypeportalAccessPermisssions' first.
10795
+ if ((_a = session.HypeportalAccessPermisssions) === null || _a === void 0 ? void 0 : _a.EnabledFeatures) {
10796
+ const perms = session.HypeportalAccessPermisssions.EnabledFeatures;
10797
+ return perms.findIndex(x => x.toLocaleUpperCase() == perm) > -1;
10798
+ }
10799
+ // Fallback to looking through groups.
10800
+ // This is important if the user directly logged into "hypeportal" as the response differs.
10801
+ else if ((_c = (_b = session.User) === null || _b === void 0 ? void 0 : _b.AccessPermissions) === null || _c === void 0 ? void 0 : _c.length) {
10802
+ const perms = session.User.AccessPermissions.find(x => String(x["ClientAccount.ID"]).toLowerCase() == "hypeportal");
10803
+ if ((_d = perms === null || perms === void 0 ? void 0 : perms.UserGroups) === null || _d === void 0 ? void 0 : _d.length) {
10804
+ for (let j = 0; j < perms.UserGroups.length; j++) {
10805
+ const group = perms.UserGroups[j];
10806
+ if (typeof group != "string") {
10807
+ const features = group.Features;
10808
+ if (features && features.findIndex(x => x.toLocaleUpperCase() == perm) > -1) {
10809
+ return true;
10810
+ }
10811
+ }
10812
+ }
10813
+ }
10814
+ }
10815
+ return false;
10788
10816
  }
10789
10817
  Session.IsSuperPermEnabled = IsSuperPermEnabled;
10790
10818
  /**
@@ -13387,7 +13415,7 @@
13387
13415
  })(exports.DataSource || (exports.DataSource = {}));
13388
13416
 
13389
13417
  // This is updated with the package.json version on build.
13390
- const VERSION = "4.5.1";
13418
+ const VERSION = "4.5.3";
13391
13419
 
13392
13420
  exports.VERSION = VERSION;
13393
13421
  exports.AbstractApi = AbstractApi;