tnx-shared 5.1.154 → 5.1.155
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/bundles/tnx-shared.umd.js +80 -54
- package/bundles/tnx-shared.umd.js.map +1 -1
- package/bundles/tnx-shared.umd.min.js +1 -1
- package/bundles/tnx-shared.umd.min.js.map +1 -1
- package/components/common-app-component/common-app-component.d.ts.map +1 -1
- package/configs/component-context.constant.d.ts +1 -0
- package/configs/component-context.constant.d.ts.map +1 -1
- package/esm2015/components/common-app-component/common-app-component.js +11 -5
- package/esm2015/configs/component-context.constant.js +2 -1
- package/esm2015/services/user.service.js +14 -2
- package/fesm2015/tnx-shared.js +24 -5
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/services/user.service.d.ts +1 -0
- package/services/user.service.d.ts.map +1 -1
- package/tnx-shared.metadata.json +1 -1
|
@@ -345,6 +345,7 @@
|
|
|
345
345
|
USER_READY: 'USER_READY',
|
|
346
346
|
USER_LOADED: 'USER_LOADED',
|
|
347
347
|
USER_INFO_CHANGED: 'USER_INFO_CHANGED',
|
|
348
|
+
NEED_CLEAR_PERMISSION_CACHE: 'CLEAR_PERMISSION_CACHE',
|
|
348
349
|
ADVANCE_SEARCH_TOGGLE_BOX: 'ADVANCE_SEARCH_TOGGLE_BOX',
|
|
349
350
|
ADVANCE_SEARCH_HIDE_BOX: 'ADVANCE_SEARCH_HIDE_BOX',
|
|
350
351
|
ADVANCE_SEARCH_INIT: 'ADVANCE_SEARCH_INIT',
|
|
@@ -9224,6 +9225,11 @@
|
|
|
9224
9225
|
}
|
|
9225
9226
|
return false;
|
|
9226
9227
|
};
|
|
9228
|
+
UserService.prototype.getFullCanBoLabel = function (item) {
|
|
9229
|
+
var label = this.getUserName(item);
|
|
9230
|
+
label = (item.maChucVu ? item.maChucVu + ". " : '') + ("" + label) + (item.tenDonVi ? " - " + item.tenDonVi : '');
|
|
9231
|
+
return label;
|
|
9232
|
+
};
|
|
9227
9233
|
UserService.prototype.getAllWithInfo = function (filters) {
|
|
9228
9234
|
return this.getDataCustomRoute('WithInfo', filters);
|
|
9229
9235
|
};
|
|
@@ -9280,6 +9286,7 @@
|
|
|
9280
9286
|
}
|
|
9281
9287
|
else {
|
|
9282
9288
|
this._applicationContext.getRootContext().replaySubscribeOnce(ComCtxConstants.ROOT.USER_READY, function (rs) {
|
|
9289
|
+
var firstTimeLogin = rs !== null && rs !== void 0 ? rs : false;
|
|
9283
9290
|
var accessToken = _this._oauthService.getAccessToken();
|
|
9284
9291
|
var decoded = JWT.default(accessToken);
|
|
9285
9292
|
// Chuyển đổi sang dùng instanceId nếu đăng nhập bằng identityv4 nhưng phải sử dụng base userOrgv5
|
|
@@ -9307,6 +9314,7 @@
|
|
|
9307
9314
|
user.role = rs1.role;
|
|
9308
9315
|
user.gender = rs1.gender;
|
|
9309
9316
|
user.positionCode = rs1.positionCode;
|
|
9317
|
+
1;
|
|
9310
9318
|
user.instanceid = decoded.instanceid;
|
|
9311
9319
|
user.idCanBo = decoded.idCanBo;
|
|
9312
9320
|
user.originId = decoded.sub;
|
|
@@ -9321,7 +9329,12 @@
|
|
|
9321
9329
|
localStorage.setItem(_this.CURRENT_USER_KEY, JSON.stringify(user));
|
|
9322
9330
|
}
|
|
9323
9331
|
_this._applicationContext.getRootContext().data.currentUser = user;
|
|
9324
|
-
|
|
9332
|
+
if (firstTimeLogin) {
|
|
9333
|
+
_this._applicationContext.getRootContext().fireEvent(ComCtxConstants.ROOT.NEED_CLEAR_PERMISSION_CACHE);
|
|
9334
|
+
}
|
|
9335
|
+
else {
|
|
9336
|
+
_this._applicationContext.getRootContext().fireReplayEvent(ComCtxConstants.ROOT.USER_LOADED, true);
|
|
9337
|
+
}
|
|
9325
9338
|
}, function (err) {
|
|
9326
9339
|
});
|
|
9327
9340
|
});
|
|
@@ -30611,60 +30624,56 @@
|
|
|
30611
30624
|
this._componentContextService.data.personalize = {};
|
|
30612
30625
|
}
|
|
30613
30626
|
this._componentContextService.replaySubscribe(ComCtxConstants.ROOT.USER_LOADED, function (rs) { return __awaiter(_this, void 0, void 0, function () {
|
|
30614
|
-
var
|
|
30627
|
+
var oldUrl;
|
|
30615
30628
|
var _this = this;
|
|
30616
30629
|
return __generator(this, function (_a) {
|
|
30617
|
-
|
|
30618
|
-
|
|
30619
|
-
|
|
30620
|
-
|
|
30621
|
-
|
|
30622
|
-
|
|
30623
|
-
|
|
30624
|
-
|
|
30625
|
-
|
|
30626
|
-
|
|
30627
|
-
|
|
30628
|
-
|
|
30629
|
-
|
|
30630
|
-
|
|
30631
|
-
|
|
30632
|
-
|
|
30633
|
-
|
|
30634
|
-
|
|
30635
|
-
|
|
30636
|
-
|
|
30637
|
-
|
|
30638
|
-
|
|
30639
|
-
|
|
30640
|
-
|
|
30641
|
-
|
|
30642
|
-
|
|
30643
|
-
|
|
30644
|
-
|
|
30645
|
-
|
|
30646
|
-
|
|
30647
|
-
|
|
30648
|
-
|
|
30649
|
-
|
|
30650
|
-
|
|
30651
|
-
|
|
30652
|
-
|
|
30653
|
-
|
|
30654
|
-
|
|
30655
|
-
|
|
30656
|
-
_this.
|
|
30657
|
-
|
|
30658
|
-
|
|
30659
|
-
|
|
30660
|
-
|
|
30661
|
-
|
|
30662
|
-
});
|
|
30663
|
-
}
|
|
30664
|
-
catch (e) {
|
|
30665
|
-
}
|
|
30666
|
-
return [2 /*return*/];
|
|
30630
|
+
this._entityMetadataService.setupSyncCacheEntityMetadata();
|
|
30631
|
+
this._router.config
|
|
30632
|
+
.forEach(function (route) { return _this.addGuard(route); });
|
|
30633
|
+
if (this.firstTimeLogin) {
|
|
30634
|
+
// lần đầu đăng nhập thì vào trang mặc định
|
|
30635
|
+
// if (this.rootVersionDeploy) {
|
|
30636
|
+
// this._storageService.setItem('versionDeploy', this.rootVersionDeploy);
|
|
30637
|
+
// }
|
|
30638
|
+
// Thêm vào để đánh dấu lần dầu login => để xử lý
|
|
30639
|
+
// UserA đag ở màn hình 1 => đăng xuất => đăng nhập vào tài khoản UserB không có quyền màn hình 1 => redirect về "/"
|
|
30640
|
+
this._storageService.removeItem('current_user_info');
|
|
30641
|
+
this._storageService.setItem('firstTimeLogin', true);
|
|
30642
|
+
oldUrl = this._storageService.getItem('currentUrl');
|
|
30643
|
+
if (oldUrl && oldUrl != top.location.href + '') {
|
|
30644
|
+
this._storageService.removeItem('currentUrl');
|
|
30645
|
+
top.location.href = "" + oldUrl;
|
|
30646
|
+
}
|
|
30647
|
+
else {
|
|
30648
|
+
this.firstTimeLogin = false;
|
|
30649
|
+
this._storageService.removeItem('currentUrl');
|
|
30650
|
+
this.pageLoaded = true;
|
|
30651
|
+
this.onlyShowMainContent = true;
|
|
30652
|
+
}
|
|
30653
|
+
}
|
|
30654
|
+
else {
|
|
30655
|
+
this.defaultRedirect();
|
|
30656
|
+
}
|
|
30657
|
+
// var versionDeploy = this._storageService.getItem('versionDeploy');
|
|
30658
|
+
// let versionFromApplication = this.rootVersionDeploy;
|
|
30659
|
+
// if (versionFromApplication && versionDeploy && (+versionDeploy) < (+versionFromApplication)) {
|
|
30660
|
+
// this._storageService.setItem('versionDeploy', versionFromApplication);
|
|
30661
|
+
// this._authenService.logout();
|
|
30662
|
+
// }
|
|
30663
|
+
this.getPinnedNotes();
|
|
30664
|
+
try {
|
|
30665
|
+
this._signalRService.init().then(function () {
|
|
30666
|
+
_this._signalRService.start('ConsistencyHub', 'BroadcastMessage', _this.clearAuthorizeCache.bind(_this));
|
|
30667
|
+
_this._signalRService.start('NotificationHub', 'RefreshForUpdate', function (data) {
|
|
30668
|
+
if (data.appCodes && data.appCodes.some(function (x) { return x.toUpperCase() == _this.appCode.toUpperCase(); })) {
|
|
30669
|
+
_this._componentContextService.fireEvent(ComCtxConstants.COMMON.FORCE_RELOAD);
|
|
30670
|
+
}
|
|
30671
|
+
});
|
|
30672
|
+
});
|
|
30673
|
+
}
|
|
30674
|
+
catch (e) {
|
|
30667
30675
|
}
|
|
30676
|
+
return [2 /*return*/];
|
|
30668
30677
|
});
|
|
30669
30678
|
}); });
|
|
30670
30679
|
var defaultModulePages = this._componentContextService.data.personalize.defaultModulePages;
|
|
@@ -30710,6 +30719,23 @@
|
|
|
30710
30719
|
root.data.allowAnonymous = this.allowAnonymous;
|
|
30711
30720
|
// get current User
|
|
30712
30721
|
this._userService.populateCurrentUser();
|
|
30722
|
+
this._componentContextService.subscribe(ComCtxConstants.ROOT.NEED_CLEAR_PERMISSION_CACHE, function () { return __awaiter(_this, void 0, void 0, function () {
|
|
30723
|
+
var lstAppCodes, res;
|
|
30724
|
+
return __generator(this, function (_a) {
|
|
30725
|
+
switch (_a.label) {
|
|
30726
|
+
case 0:
|
|
30727
|
+
lstAppCodes = this.environment.appMetadata.appSwitcher.map(function (app) { return app.code; });
|
|
30728
|
+
return [4 /*yield*/, this._permissionService.cleanPermissionCache(lstAppCodes)];
|
|
30729
|
+
case 1:
|
|
30730
|
+
res = _a.sent();
|
|
30731
|
+
if (!res.success) {
|
|
30732
|
+
this._notifierService.showWarning('Có lỗi trong lúc clear cache phân quyền');
|
|
30733
|
+
}
|
|
30734
|
+
this._applicationContext.getRootContext().fireReplayEvent(ComCtxConstants.ROOT.USER_LOADED);
|
|
30735
|
+
return [2 /*return*/];
|
|
30736
|
+
}
|
|
30737
|
+
});
|
|
30738
|
+
}); });
|
|
30713
30739
|
this._componentContextService.subscribe(ComCtxConstants.ROOT.KEY_DOWN_ARROWLEFT, function (e) {
|
|
30714
30740
|
if (document.activeElement === _this.cancelButton.nativeElement) {
|
|
30715
30741
|
_this.okButton.nativeElement.focus();
|
|
@@ -30943,7 +30969,7 @@
|
|
|
30943
30969
|
_this._authenService.cleanupLocalStorage();
|
|
30944
30970
|
_this._authenService.cleanupSessionStorage();
|
|
30945
30971
|
_this._storageUpdatedService.cleanupStorageService();
|
|
30946
|
-
_this._componentContextService.fireReplayEvent(ComCtxConstants.ROOT.USER_READY,
|
|
30972
|
+
_this._componentContextService.fireReplayEvent(ComCtxConstants.ROOT.USER_READY, _this.firstTimeLogin);
|
|
30947
30973
|
}
|
|
30948
30974
|
else if (evt.type === 'token_expires') {
|
|
30949
30975
|
_this._oauthService.tryLogin();
|
|
@@ -30974,7 +31000,7 @@
|
|
|
30974
31000
|
this._permissionService.cleanPermissionCache(lstPhanHeCode);
|
|
30975
31001
|
}
|
|
30976
31002
|
if (this._oauthService.hasValidAccessToken()) {
|
|
30977
|
-
this._componentContextService.fireReplayEvent(ComCtxConstants.ROOT.USER_READY,
|
|
31003
|
+
this._componentContextService.fireReplayEvent(ComCtxConstants.ROOT.USER_READY, this.firstTimeLogin);
|
|
30978
31004
|
this._oauthService.setupAutomaticSilentRefresh();
|
|
30979
31005
|
}
|
|
30980
31006
|
else {
|