bruce-models 6.4.7 → 6.4.8
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 +36 -1
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +36 -1
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/user/user.js +35 -0
- package/dist/lib/user/user.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/user/user.d.ts +10 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -12466,6 +12466,41 @@
|
|
|
12466
12466
|
// Access token. Used to gain access to related permissions.
|
|
12467
12467
|
EType["AccessToken"] = "ACCESS_TOKEN";
|
|
12468
12468
|
})(EType = User.EType || (User.EType = {}));
|
|
12469
|
+
/**
|
|
12470
|
+
* Returns an array of User Group IDs for the User that have been loaded.
|
|
12471
|
+
* Note, this does not perform an API lookup if the User instance hasn't loaded the specific account's details.
|
|
12472
|
+
* @param params
|
|
12473
|
+
* @returns
|
|
12474
|
+
*/
|
|
12475
|
+
function UnpackRelatedUserGroupIDs(params) {
|
|
12476
|
+
var _a, _b;
|
|
12477
|
+
const { user, accountId } = params;
|
|
12478
|
+
if (!user || !accountId) {
|
|
12479
|
+
throw ("User and accountId are required.");
|
|
12480
|
+
}
|
|
12481
|
+
let accessPerms = user.AccessPermissions;
|
|
12482
|
+
if (!accessPerms || !Array.isArray(accessPerms) || accessPerms.length === 0) {
|
|
12483
|
+
return [];
|
|
12484
|
+
}
|
|
12485
|
+
for (const perm of accessPerms) {
|
|
12486
|
+
if (!perm || perm["ClientAccount.ID"] !== accountId) {
|
|
12487
|
+
continue;
|
|
12488
|
+
}
|
|
12489
|
+
else if ((_a = perm["UserGroup.ID"]) === null || _a === void 0 ? void 0 : _a.length) {
|
|
12490
|
+
return perm["UserGroup.ID"];
|
|
12491
|
+
}
|
|
12492
|
+
else if ((_b = perm.UserGroups) === null || _b === void 0 ? void 0 : _b.length) {
|
|
12493
|
+
if (typeof perm.UserGroups[0] === "string") {
|
|
12494
|
+
return perm.UserGroups;
|
|
12495
|
+
}
|
|
12496
|
+
else if (typeof perm.UserGroups[0] === "object") {
|
|
12497
|
+
return perm.UserGroups.map(group => group.ID);
|
|
12498
|
+
}
|
|
12499
|
+
}
|
|
12500
|
+
}
|
|
12501
|
+
return [];
|
|
12502
|
+
}
|
|
12503
|
+
User.UnpackRelatedUserGroupIDs = UnpackRelatedUserGroupIDs;
|
|
12469
12504
|
/**
|
|
12470
12505
|
* Gets a user record.
|
|
12471
12506
|
* @param params
|
|
@@ -15715,7 +15750,7 @@
|
|
|
15715
15750
|
})(exports.Tracking || (exports.Tracking = {}));
|
|
15716
15751
|
|
|
15717
15752
|
// This is updated with the package.json version on build.
|
|
15718
|
-
const VERSION = "6.4.
|
|
15753
|
+
const VERSION = "6.4.8";
|
|
15719
15754
|
|
|
15720
15755
|
exports.VERSION = VERSION;
|
|
15721
15756
|
exports.AbstractApi = AbstractApi;
|