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.
- package/dist/bruce-models.es5.js +13 -7
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +13 -7
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/user/session.js +13 -7
- package/dist/lib/user/session.js.map +1 -1
- package/dist/types/account/account.d.ts +2 -2
- package/dist/types/user/session.d.ts +10 -5
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -4693,14 +4693,20 @@
|
|
|
4693
4693
|
});
|
|
4694
4694
|
}
|
|
4695
4695
|
Session.Logout = Logout;
|
|
4696
|
-
function IsPermEnabled(session, perm) {
|
|
4697
|
-
var _a
|
|
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
|
|
4703
|
-
|
|
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) {
|