bruce-models 1.3.2 → 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.umd.js
CHANGED
|
@@ -5401,10 +5401,24 @@
|
|
|
5401
5401
|
}
|
|
5402
5402
|
User.Get = Get;
|
|
5403
5403
|
function Update(api, data, reqParams) {
|
|
5404
|
+
var _a;
|
|
5404
5405
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5405
5406
|
if (!(data === null || data === void 0 ? void 0 : data.ID) || !(data === null || data === void 0 ? void 0 : data.Type)) {
|
|
5406
5407
|
throw ("ID and Type are required.");
|
|
5407
5408
|
}
|
|
5409
|
+
// When getting a user it is structured slightly different to when we update it.
|
|
5410
|
+
// We can make up the difference here.
|
|
5411
|
+
if ((_a = data.AccessPermissions) === null || _a === void 0 ? void 0 : _a.length) {
|
|
5412
|
+
for (let i = 0; i < data.AccessPermissions.length; i++) {
|
|
5413
|
+
const perm = data.AccessPermissions[i];
|
|
5414
|
+
if (!perm["UserGroup.ID"] && perm.UserGroups) {
|
|
5415
|
+
perm["UserGroup.ID"] = [];
|
|
5416
|
+
for (let j = 0; j < perm.UserGroups.length; j++) {
|
|
5417
|
+
perm["UserGroup.ID"].push(perm.UserGroups[j].ID);
|
|
5418
|
+
}
|
|
5419
|
+
}
|
|
5420
|
+
}
|
|
5421
|
+
}
|
|
5408
5422
|
data = yield api.POST(`user/${data.ID}`, data, reqParams);
|
|
5409
5423
|
api.Cache.RemoveByContains(exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + data.ID);
|
|
5410
5424
|
if (data.Type == EType.AccessToken) {
|
|
@@ -5439,6 +5453,14 @@
|
|
|
5439
5453
|
res(settings);
|
|
5440
5454
|
}
|
|
5441
5455
|
catch (e) {
|
|
5456
|
+
// It will complain if an app id hasn't been used yet.
|
|
5457
|
+
// We need to suppress that error.
|
|
5458
|
+
if (e && typeof e == "object") {
|
|
5459
|
+
if (e.ERROR && typeof e.ERROR == "object" && e.ERROR.Type == "NotFound") {
|
|
5460
|
+
res({});
|
|
5461
|
+
return;
|
|
5462
|
+
}
|
|
5463
|
+
}
|
|
5442
5464
|
rej(e);
|
|
5443
5465
|
}
|
|
5444
5466
|
}));
|