bruce-models 0.3.5 → 0.3.7

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.
@@ -5039,19 +5039,28 @@ var Session;
5039
5039
  }
5040
5040
  Session.Logout = Logout;
5041
5041
  function IsPermEnabled(session, accountId, perm) {
5042
- var _a;
5042
+ var _a, _b;
5043
5043
  if (!perm) {
5044
5044
  throw ("Perm is required.");
5045
5045
  }
5046
5046
  perm = perm.toLocaleUpperCase();
5047
- 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; });
5048
- if (!group) {
5047
+ var perms = (_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.find(function (x) { return x["ClientAccount.ID"] == accountId; });
5048
+ if (!perms) {
5049
5049
  return false;
5050
5050
  }
5051
- if (!group.EnabledFeatures) {
5052
- group.EnabledFeatures = [];
5051
+ if (!perms.UserGroups) {
5052
+ perms.UserGroups = [];
5053
+ }
5054
+ for (var i = 0; i < perms.UserGroups.length; i++) {
5055
+ var group = perms.UserGroups[i];
5056
+ if (typeof group != "string") {
5057
+ var features = group.Features;
5058
+ if (features && features.findIndex(function (x) { return x.toLocaleUpperCase() == perm; }) > -1) {
5059
+ return true;
5060
+ }
5061
+ }
5053
5062
  }
5054
- return group.EnabledFeatures.findIndex(function (x) { return x.toLocaleUpperCase() == perm; }) > -1;
5063
+ return false;
5055
5064
  }
5056
5065
  Session.IsPermEnabled = IsPermEnabled;
5057
5066
  function IsSuperPermEnabled(session, perm) {