bruce-models 1.3.3 → 1.3.5
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 +17 -3
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +17 -3
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/user/user.js +17 -3
- package/dist/lib/user/user.js.map +1 -1
- package/dist/types/user/user.d.ts +1 -1
- package/package.json +1 -1
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) {
|
|
@@ -5443,7 +5457,7 @@
|
|
|
5443
5457
|
// We need to suppress that error.
|
|
5444
5458
|
if (e && typeof e == "object") {
|
|
5445
5459
|
if (e.ERROR && typeof e.ERROR == "object" && e.ERROR.Type == "NotFound") {
|
|
5446
|
-
res(
|
|
5460
|
+
res({});
|
|
5447
5461
|
return;
|
|
5448
5462
|
}
|
|
5449
5463
|
}
|
|
@@ -5478,12 +5492,12 @@
|
|
|
5478
5492
|
});
|
|
5479
5493
|
}
|
|
5480
5494
|
User.UpdateSettings = UpdateSettings;
|
|
5481
|
-
function GetUsernameAvailable(api, username, reqParams) {
|
|
5495
|
+
function GetUsernameAvailable(api, username, excludeUserId, reqParams) {
|
|
5482
5496
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5483
5497
|
if (!username) {
|
|
5484
5498
|
throw ("Username is required.");
|
|
5485
5499
|
}
|
|
5486
|
-
const req = api.GET(`user/loginavailable/${username}`, reqParams);
|
|
5500
|
+
const req = api.GET(`user/loginavailable/${username}${excludeUserId ? "?excludeUserId=" + excludeUserId : ""}`, reqParams);
|
|
5487
5501
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
5488
5502
|
try {
|
|
5489
5503
|
const data = yield req;
|