tnx-shared 5.0.61 → 5.0.63
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 +56 -7
- 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 +4 -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/app.menu.component.js +2 -2
- package/esm2015/components/common-app-component/common-app-component.js +26 -3
- package/esm2015/configs/component-context.constant.js +3 -2
- package/esm2015/services/menu.service.js +6 -3
- package/esm2015/services/permission.service.js +9 -2
- package/esm2015/services/user.service.js +8 -2
- package/fesm2015/tnx-shared.js +47 -8
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/services/menu.service.d.ts +1 -1
- package/services/menu.service.d.ts.map +1 -1
- package/services/permission.service.d.ts +1 -0
- package/services/permission.service.d.ts.map +1 -1
- package/services/user.service.d.ts.map +1 -1
- package/tnx-shared.metadata.json +1 -1
|
@@ -395,7 +395,8 @@
|
|
|
395
395
|
MENU_CHANGED: 'MENU_CHANGED',
|
|
396
396
|
ADVANCE_SEARCH_INIT_WITHOUT_UPDATE_ROUTER: 'ADVANCE_SEARCH_INIT_WITHOUT_UPDATE_ROUTER',
|
|
397
397
|
SHOW_WAIT_BOX: 'SHOW_WAIT_BOX',
|
|
398
|
-
SHOW_REJECT_CONFIRM: 'SHOW_REJECT_CONFIRM'
|
|
398
|
+
SHOW_REJECT_CONFIRM: 'SHOW_REJECT_CONFIRM',
|
|
399
|
+
NEED_CLEAR_PERMISSION_CACHE: 'NEED_CLEAR_PERMISSION_CACHE'
|
|
399
400
|
};
|
|
400
401
|
ComCtxConstants.ROOT_USMART = {
|
|
401
402
|
SHOW_CONFIG_DATA_DEFAULT: 'SHOW_CONFIG_DATA_DEFAULT',
|
|
@@ -8940,6 +8941,7 @@
|
|
|
8940
8941
|
}
|
|
8941
8942
|
else {
|
|
8942
8943
|
this._applicationContext.getRootContext().replaySubscribeOnce(ComCtxConstants.ROOT.USER_READY, function (rs) {
|
|
8944
|
+
var firstTimeLogin = rs;
|
|
8943
8945
|
var accessToken = _this._oauthService.getAccessToken();
|
|
8944
8946
|
var decoded = JWT.default(accessToken);
|
|
8945
8947
|
// Chuyển đổi sang dùng instanceId nếu đăng nhập bằng identityv4 nhưng phải sử dụng base userOrgv5
|
|
@@ -8981,7 +8983,12 @@
|
|
|
8981
8983
|
localStorage.setItem(_this.CURRENT_USER_KEY, JSON.stringify(user));
|
|
8982
8984
|
}
|
|
8983
8985
|
_this._applicationContext.getRootContext().data.currentUser = user;
|
|
8984
|
-
|
|
8986
|
+
if (firstTimeLogin) {
|
|
8987
|
+
_this._applicationContext.getRootContext().fireEvent(ComCtxConstants.ROOT.NEED_CLEAR_PERMISSION_CACHE);
|
|
8988
|
+
}
|
|
8989
|
+
else {
|
|
8990
|
+
_this._applicationContext.getRootContext().fireReplayEvent(ComCtxConstants.ROOT.USER_LOADED, true);
|
|
8991
|
+
}
|
|
8985
8992
|
}, function (err) {
|
|
8986
8993
|
});
|
|
8987
8994
|
});
|
|
@@ -9541,9 +9548,12 @@
|
|
|
9541
9548
|
_this.delayCheckPermissions = [];
|
|
9542
9549
|
_this.ignoreAdmin = false;
|
|
9543
9550
|
_this.appCode = null;
|
|
9551
|
+
if (_moduleConfigService.getConfig().environment.authenticationSettings.coreVersion == 'v4') {
|
|
9552
|
+
_this.serviceUri = _moduleConfigService.getConfig().environment.apiDomain.authorizationEndpoint + "/permission";
|
|
9553
|
+
}
|
|
9544
9554
|
_this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.authorizationEndpoint;
|
|
9545
|
-
_this.ignoreAdmin = _this._moduleConfigService.getConfig().environment.isIgnoreAdmin;
|
|
9546
9555
|
_this.appCode = _this._moduleConfigService.getConfig().appCode;
|
|
9556
|
+
_this.ignoreAdmin = _this._moduleConfigService.getConfig().environment.isIgnoreAdmin;
|
|
9547
9557
|
return _this;
|
|
9548
9558
|
}
|
|
9549
9559
|
/**
|
|
@@ -9765,6 +9775,10 @@
|
|
|
9765
9775
|
}
|
|
9766
9776
|
});
|
|
9767
9777
|
};
|
|
9778
|
+
PermissionService.prototype.clearPermissionCache = function (lstModule) {
|
|
9779
|
+
var url = this.serviceUri + "/ClearPermissionCache";
|
|
9780
|
+
return this.defaultPost(url, lstModule);
|
|
9781
|
+
};
|
|
9768
9782
|
return PermissionService;
|
|
9769
9783
|
}(BaseService));
|
|
9770
9784
|
PermissionService.ɵprov = i0.ɵɵdefineInjectable({ factory: function PermissionService_Factory() { return new PermissionService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService), i0.ɵɵinject(UserService), i0.ɵɵinject(i4.OAuthService), i0.ɵɵinject(ApplicationContextService)); }, token: PermissionService, providedIn: "root" });
|
|
@@ -20728,13 +20742,16 @@
|
|
|
20728
20742
|
});
|
|
20729
20743
|
});
|
|
20730
20744
|
};
|
|
20731
|
-
MenuService.prototype.renderMenuByAppCode = function (appCode) {
|
|
20745
|
+
MenuService.prototype.renderMenuByAppCode = function (scopeName, appCode) {
|
|
20732
20746
|
return __awaiter(this, void 0, void 0, function () {
|
|
20733
20747
|
var menuUrl;
|
|
20734
20748
|
var _this = this;
|
|
20735
20749
|
return __generator(this, function (_a) {
|
|
20736
20750
|
this._menuItems = [];
|
|
20737
20751
|
menuUrl = "assets/menus/" + appCode.toLocaleLowerCase() + ".json";
|
|
20752
|
+
if (scopeName) {
|
|
20753
|
+
menuUrl = "assets/menus/" + scopeName.toLocaleLowerCase() + "/" + appCode.toLocaleLowerCase() + ".json";
|
|
20754
|
+
}
|
|
20738
20755
|
fetch(menuUrl).then(function (rs) { return __awaiter(_this, void 0, void 0, function () {
|
|
20739
20756
|
var menu, _a, _b;
|
|
20740
20757
|
return __generator(this, function (_c) {
|
|
@@ -20888,7 +20905,7 @@
|
|
|
20888
20905
|
// Nếu là môi trường triển khai thì cộng thêm tiền tố phân hệ vào router link để có thể chuột phải mở tab mới
|
|
20889
20906
|
funcSetNewTabLink = function (link) { return "/" + appCodeLowerCase + link; };
|
|
20890
20907
|
}
|
|
20891
|
-
this._menuService.renderMenuByAppCode(appCode);
|
|
20908
|
+
this._menuService.renderMenuByAppCode(this.environment.scopeName, appCode);
|
|
20892
20909
|
this.model = this._menuService.getMenuItems();
|
|
20893
20910
|
this._router.events.pipe(operators.filter(function (event) { return event instanceof i3.NavigationEnd; }))
|
|
20894
20911
|
.subscribe(function (event) {
|
|
@@ -23449,7 +23466,7 @@
|
|
|
23449
23466
|
};
|
|
23450
23467
|
|
|
23451
23468
|
var CommonAppComponentComponent = /** @class */ (function () {
|
|
23452
|
-
function CommonAppComponentComponent(_globalService, _commonService, renderer, translate, _oauthService, _authenService, _userService, _router, _title, _signalRService, _storageUpdatedService, _customRouteService, _applicationContext, _componentContextService, _activatedRoute, _deviceDetectorService, _cd, _tnClientService, _coreConfigService, _notifierService, _entityMetadataService, _moduleConfigService, _translateService, _messageService, _confirmService, _menuService, _primengConfig, _storageService) {
|
|
23469
|
+
function CommonAppComponentComponent(_globalService, _commonService, renderer, translate, _oauthService, _authenService, _userService, _router, _title, _signalRService, _storageUpdatedService, _customRouteService, _applicationContext, _componentContextService, _activatedRoute, _deviceDetectorService, _cd, _tnClientService, _coreConfigService, _notifierService, _entityMetadataService, _moduleConfigService, _translateService, _messageService, _confirmService, _menuService, _primengConfig, _storageService, _permissionService) {
|
|
23453
23470
|
var _this = this;
|
|
23454
23471
|
this._globalService = _globalService;
|
|
23455
23472
|
this._commonService = _commonService;
|
|
@@ -23479,6 +23496,7 @@
|
|
|
23479
23496
|
this._menuService = _menuService;
|
|
23480
23497
|
this._primengConfig = _primengConfig;
|
|
23481
23498
|
this._storageService = _storageService;
|
|
23499
|
+
this._permissionService = _permissionService;
|
|
23482
23500
|
this.showQuickNote = true;
|
|
23483
23501
|
this.allowAnonymous = false;
|
|
23484
23502
|
this._unsubscribeAll = new rxjs.Subject();
|
|
@@ -23632,6 +23650,25 @@
|
|
|
23632
23650
|
root.data.allowAnonymous = this.allowAnonymous;
|
|
23633
23651
|
// get current User
|
|
23634
23652
|
this._userService.populateCurrentUser();
|
|
23653
|
+
this._componentContextService.subscribe(ComCtxConstants.ROOT.NEED_CLEAR_PERMISSION_CACHE, function () { return __awaiter(_this, void 0, void 0, function () {
|
|
23654
|
+
var clear;
|
|
23655
|
+
return __generator(this, function (_a) {
|
|
23656
|
+
switch (_a.label) {
|
|
23657
|
+
case 0:
|
|
23658
|
+
if (!(this.environment.authenticationSettings.coreVersion == 'v4')) return [3 /*break*/, 2];
|
|
23659
|
+
return [4 /*yield*/, this.clearPermissionCacheByModule()];
|
|
23660
|
+
case 1:
|
|
23661
|
+
clear = _a.sent();
|
|
23662
|
+
if (!clear.success) {
|
|
23663
|
+
this._notifierService.showWarning('Có vấn đề trong lúc clear cache quyền');
|
|
23664
|
+
}
|
|
23665
|
+
_a.label = 2;
|
|
23666
|
+
case 2:
|
|
23667
|
+
this._applicationContext.getRootContext().fireReplayEvent(ComCtxConstants.ROOT.USER_LOADED);
|
|
23668
|
+
return [2 /*return*/];
|
|
23669
|
+
}
|
|
23670
|
+
});
|
|
23671
|
+
}); });
|
|
23635
23672
|
this._componentContextService.subscribe(ComCtxConstants.ROOT.KEY_DOWN_ARROWLEFT, function (e) {
|
|
23636
23673
|
if (document.activeElement === _this.cancelButton.nativeElement) {
|
|
23637
23674
|
_this.okButton.nativeElement.focus();
|
|
@@ -24147,6 +24184,17 @@
|
|
|
24147
24184
|
}
|
|
24148
24185
|
}
|
|
24149
24186
|
};
|
|
24187
|
+
CommonAppComponentComponent.prototype.clearPermissionCacheByModule = function () {
|
|
24188
|
+
var appSwitcher = this._moduleConfigService.getConfig().environment.appMetadata.appSwitcher;
|
|
24189
|
+
if (!appSwitcher || !appSwitcher.length) {
|
|
24190
|
+
appSwitcher = [];
|
|
24191
|
+
}
|
|
24192
|
+
var lstModule = appSwitcher.map(function (x) { return x.code; });
|
|
24193
|
+
if (!lstModule) {
|
|
24194
|
+
lstModule = [];
|
|
24195
|
+
}
|
|
24196
|
+
return this._permissionService.clearPermissionCache(lstModule);
|
|
24197
|
+
};
|
|
24150
24198
|
return CommonAppComponentComponent;
|
|
24151
24199
|
}());
|
|
24152
24200
|
CommonAppComponentComponent.decorators = [
|
|
@@ -24185,7 +24233,8 @@
|
|
|
24185
24233
|
{ type: i1.ConfirmationService },
|
|
24186
24234
|
{ type: MenuService },
|
|
24187
24235
|
{ type: i1.PrimeNGConfig },
|
|
24188
|
-
{ type: StorageService }
|
|
24236
|
+
{ type: StorageService },
|
|
24237
|
+
{ type: PermissionService }
|
|
24189
24238
|
]; };
|
|
24190
24239
|
CommonAppComponentComponent.propDecorators = {
|
|
24191
24240
|
okButton: [{ type: i0.ViewChild, args: ['okButton',] }],
|