bruce-models 1.3.3 → 1.3.4
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
CHANGED
|
@@ -5606,10 +5606,24 @@ var User;
|
|
|
5606
5606
|
}
|
|
5607
5607
|
User.Get = Get;
|
|
5608
5608
|
function Update(api, data, reqParams) {
|
|
5609
|
+
var _a;
|
|
5609
5610
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5610
5611
|
if (!(data === null || data === void 0 ? void 0 : data.ID) || !(data === null || data === void 0 ? void 0 : data.Type)) {
|
|
5611
5612
|
throw ("ID and Type are required.");
|
|
5612
5613
|
}
|
|
5614
|
+
// When getting a user it is structured slightly different to when we update it.
|
|
5615
|
+
// We can make up the difference here.
|
|
5616
|
+
if ((_a = data.AccessPermissions) === null || _a === void 0 ? void 0 : _a.length) {
|
|
5617
|
+
for (let i = 0; i < data.AccessPermissions.length; i++) {
|
|
5618
|
+
const perm = data.AccessPermissions[i];
|
|
5619
|
+
if (!perm["UserGroup.ID"] && perm.UserGroups) {
|
|
5620
|
+
perm["UserGroup.ID"] = [];
|
|
5621
|
+
for (let j = 0; j < perm.UserGroups.length; j++) {
|
|
5622
|
+
perm["UserGroup.ID"].push(perm.UserGroups[j].ID);
|
|
5623
|
+
}
|
|
5624
|
+
}
|
|
5625
|
+
}
|
|
5626
|
+
}
|
|
5613
5627
|
data = yield api.POST(`user/${data.ID}`, data, reqParams);
|
|
5614
5628
|
api.Cache.RemoveByContains(Api.ECacheKey.User + Api.ECacheKey.Id + data.ID);
|
|
5615
5629
|
if (data.Type == EType.AccessToken) {
|
|
@@ -5648,7 +5662,7 @@ var User;
|
|
|
5648
5662
|
// We need to suppress that error.
|
|
5649
5663
|
if (e && typeof e == "object") {
|
|
5650
5664
|
if (e.ERROR && typeof e.ERROR == "object" && e.ERROR.Type == "NotFound") {
|
|
5651
|
-
res(
|
|
5665
|
+
res({});
|
|
5652
5666
|
return;
|
|
5653
5667
|
}
|
|
5654
5668
|
}
|