bruce-models 0.2.0 → 0.2.2

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.
@@ -4693,14 +4693,20 @@
4693
4693
  });
4694
4694
  }
4695
4695
  Session.Logout = Logout;
4696
- function IsPermEnabled(session, perm) {
4697
- var _a, _b;
4696
+ function IsPermEnabled(session, accountId, perm) {
4697
+ var _a;
4698
4698
  if (!perm) {
4699
4699
  throw ("Perm is required.");
4700
4700
  }
4701
4701
  perm = perm.toLocaleUpperCase();
4702
- var accessPerms = (_b = (_a = session.AccessPermissions) === null || _a === void 0 ? void 0 : _a.EnabledFeatures) !== null && _b !== void 0 ? _b : [];
4703
- return accessPerms.findIndex(function (x) { return x.toLocaleUpperCase() == perm; }) > -1;
4702
+ var group = (_a = session === null || session === void 0 ? void 0 : session.AccessPermissions) === null || _a === void 0 ? void 0 : _a.find(function (x) { return x["ClientAccount.ID"] == accountId; });
4703
+ if (!group) {
4704
+ return false;
4705
+ }
4706
+ if (!group.EnabledFeatures) {
4707
+ group.EnabledFeatures = [];
4708
+ }
4709
+ return group.EnabledFeatures.findIndex(function (x) { return x.toLocaleUpperCase() == perm; }) > -1;
4704
4710
  }
4705
4711
  Session.IsPermEnabled = IsPermEnabled;
4706
4712
  function IsSuperPermEnabled(session, perm) {
@@ -4709,12 +4715,12 @@
4709
4715
  throw ("Perm is required.");
4710
4716
  }
4711
4717
  perm = perm.toLocaleUpperCase();
4712
- var accessPerms = (_b = (_a = session.HypeportalAccessPermisssions) === null || _a === void 0 ? void 0 : _a.EnabledFeatures) !== null && _b !== void 0 ? _b : [];
4718
+ var 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 : [];
4713
4719
  return accessPerms.findIndex(function (x) { return x.toLocaleUpperCase() == perm; }) > -1;
4714
4720
  }
4715
4721
  Session.IsSuperPermEnabled = IsSuperPermEnabled;
4716
- function IsAccountAdmin(session) {
4717
- return IsPermEnabled(session, exports.Permission.EPerm.ADMIN);
4722
+ function IsAccountAdmin(session, accountId) {
4723
+ return IsPermEnabled(session, accountId, exports.Permission.EPerm.ADMIN);
4718
4724
  }
4719
4725
  Session.IsAccountAdmin = IsAccountAdmin;
4720
4726
  function IsSuperAdmin(session) {