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.es5.js
CHANGED
|
@@ -4861,14 +4861,20 @@ var Session;
|
|
|
4861
4861
|
});
|
|
4862
4862
|
}
|
|
4863
4863
|
Session.Logout = Logout;
|
|
4864
|
-
function IsPermEnabled(session, perm) {
|
|
4865
|
-
var _a
|
|
4864
|
+
function IsPermEnabled(session, accountId, perm) {
|
|
4865
|
+
var _a;
|
|
4866
4866
|
if (!perm) {
|
|
4867
4867
|
throw ("Perm is required.");
|
|
4868
4868
|
}
|
|
4869
4869
|
perm = perm.toLocaleUpperCase();
|
|
4870
|
-
var
|
|
4871
|
-
|
|
4870
|
+
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; });
|
|
4871
|
+
if (!group) {
|
|
4872
|
+
return false;
|
|
4873
|
+
}
|
|
4874
|
+
if (!group.EnabledFeatures) {
|
|
4875
|
+
group.EnabledFeatures = [];
|
|
4876
|
+
}
|
|
4877
|
+
return group.EnabledFeatures.findIndex(function (x) { return x.toLocaleUpperCase() == perm; }) > -1;
|
|
4872
4878
|
}
|
|
4873
4879
|
Session.IsPermEnabled = IsPermEnabled;
|
|
4874
4880
|
function IsSuperPermEnabled(session, perm) {
|
|
@@ -4877,12 +4883,12 @@ var Session;
|
|
|
4877
4883
|
throw ("Perm is required.");
|
|
4878
4884
|
}
|
|
4879
4885
|
perm = perm.toLocaleUpperCase();
|
|
4880
|
-
var accessPerms = (_b = (_a = session.HypeportalAccessPermisssions) === null || _a === void 0 ? void 0 : _a.EnabledFeatures) !== null && _b !== void 0 ? _b : [];
|
|
4886
|
+
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 : [];
|
|
4881
4887
|
return accessPerms.findIndex(function (x) { return x.toLocaleUpperCase() == perm; }) > -1;
|
|
4882
4888
|
}
|
|
4883
4889
|
Session.IsSuperPermEnabled = IsSuperPermEnabled;
|
|
4884
|
-
function IsAccountAdmin(session) {
|
|
4885
|
-
return IsPermEnabled(session, Permission.EPerm.ADMIN);
|
|
4890
|
+
function IsAccountAdmin(session, accountId) {
|
|
4891
|
+
return IsPermEnabled(session, accountId, Permission.EPerm.ADMIN);
|
|
4886
4892
|
}
|
|
4887
4893
|
Session.IsAccountAdmin = IsAccountAdmin;
|
|
4888
4894
|
function IsSuperAdmin(session) {
|