tnx-shared 5.0.61 → 5.0.62
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 +53 -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 +6 -2
- package/esm2015/services/user.service.js +8 -2
- package/fesm2015/tnx-shared.js +44 -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
package/fesm2015/tnx-shared.js
CHANGED
|
@@ -135,7 +135,8 @@ ComCtxConstants.ROOT = {
|
|
|
135
135
|
MENU_CHANGED: 'MENU_CHANGED',
|
|
136
136
|
ADVANCE_SEARCH_INIT_WITHOUT_UPDATE_ROUTER: 'ADVANCE_SEARCH_INIT_WITHOUT_UPDATE_ROUTER',
|
|
137
137
|
SHOW_WAIT_BOX: 'SHOW_WAIT_BOX',
|
|
138
|
-
SHOW_REJECT_CONFIRM: 'SHOW_REJECT_CONFIRM'
|
|
138
|
+
SHOW_REJECT_CONFIRM: 'SHOW_REJECT_CONFIRM',
|
|
139
|
+
NEED_CLEAR_PERMISSION_CACHE: 'NEED_CLEAR_PERMISSION_CACHE'
|
|
139
140
|
};
|
|
140
141
|
ComCtxConstants.ROOT_USMART = {
|
|
141
142
|
SHOW_CONFIG_DATA_DEFAULT: 'SHOW_CONFIG_DATA_DEFAULT',
|
|
@@ -7614,6 +7615,7 @@ class UserService extends BaseService {
|
|
|
7614
7615
|
}
|
|
7615
7616
|
else {
|
|
7616
7617
|
this._applicationContext.getRootContext().replaySubscribeOnce(ComCtxConstants.ROOT.USER_READY, rs => {
|
|
7618
|
+
const firstTimeLogin = rs;
|
|
7617
7619
|
const accessToken = this._oauthService.getAccessToken();
|
|
7618
7620
|
const decoded = JWT.default(accessToken);
|
|
7619
7621
|
// Chuyển đổi sang dùng instanceId nếu đăng nhập bằng identityv4 nhưng phải sử dụng base userOrgv5
|
|
@@ -7655,7 +7657,12 @@ class UserService extends BaseService {
|
|
|
7655
7657
|
localStorage.setItem(this.CURRENT_USER_KEY, JSON.stringify(user));
|
|
7656
7658
|
}
|
|
7657
7659
|
this._applicationContext.getRootContext().data.currentUser = user;
|
|
7658
|
-
|
|
7660
|
+
if (firstTimeLogin) {
|
|
7661
|
+
this._applicationContext.getRootContext().fireEvent(ComCtxConstants.ROOT.NEED_CLEAR_PERMISSION_CACHE);
|
|
7662
|
+
}
|
|
7663
|
+
else {
|
|
7664
|
+
this._applicationContext.getRootContext().fireReplayEvent(ComCtxConstants.ROOT.USER_LOADED, true);
|
|
7665
|
+
}
|
|
7659
7666
|
}, err => {
|
|
7660
7667
|
});
|
|
7661
7668
|
});
|
|
@@ -8166,7 +8173,7 @@ GlobalService.ctorParameters = () => [];
|
|
|
8166
8173
|
|
|
8167
8174
|
class PermissionService extends BaseService {
|
|
8168
8175
|
constructor(http, injector, _moduleConfigService, _userService, _oauthService, _appContext) {
|
|
8169
|
-
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.authorizationEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/permission`);
|
|
8176
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.authenticationSettings.coreVersion == 'v4' ? _moduleConfigService.getConfig().environment.apiDomain.authorizationEndpoint : `${_moduleConfigService.getConfig().environment.apiDomain.authorizationEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}`}/permission`);
|
|
8170
8177
|
this._moduleConfigService = _moduleConfigService;
|
|
8171
8178
|
this._userService = _userService;
|
|
8172
8179
|
this._oauthService = _oauthService;
|
|
@@ -8312,6 +8319,10 @@ class PermissionService extends BaseService {
|
|
|
8312
8319
|
}
|
|
8313
8320
|
});
|
|
8314
8321
|
}
|
|
8322
|
+
clearPermissionCache(lstModule) {
|
|
8323
|
+
const url = `${this.serviceUri}/ClearPermissionCache`;
|
|
8324
|
+
return this.defaultPost(url, lstModule);
|
|
8325
|
+
}
|
|
8315
8326
|
}
|
|
8316
8327
|
PermissionService.ɵprov = ɵɵdefineInjectable({ factory: function PermissionService_Factory() { return new PermissionService(ɵɵinject(HttpClient), ɵɵinject(INJECTOR), ɵɵinject(ModuleConfigService), ɵɵinject(UserService), ɵɵinject(OAuthService), ɵɵinject(ApplicationContextService)); }, token: PermissionService, providedIn: "root" });
|
|
8317
8328
|
PermissionService.decorators = [
|
|
@@ -21433,10 +21444,13 @@ class MenuService {
|
|
|
21433
21444
|
}
|
|
21434
21445
|
});
|
|
21435
21446
|
}
|
|
21436
|
-
renderMenuByAppCode(appCode) {
|
|
21447
|
+
renderMenuByAppCode(scopeName, appCode) {
|
|
21437
21448
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21438
21449
|
this._menuItems = [];
|
|
21439
|
-
|
|
21450
|
+
let menuUrl = `assets/menus/${appCode.toLocaleLowerCase()}.json`;
|
|
21451
|
+
if (scopeName) {
|
|
21452
|
+
menuUrl = `assets/menus/${scopeName.toLocaleLowerCase()}/${appCode.toLocaleLowerCase()}.json`;
|
|
21453
|
+
}
|
|
21440
21454
|
fetch(menuUrl).then((rs) => __awaiter(this, void 0, void 0, function* () {
|
|
21441
21455
|
const menu = JSON.parse(yield rs.text());
|
|
21442
21456
|
this.setMenuItems(menu);
|
|
@@ -21595,7 +21609,7 @@ class AppMenuComponent {
|
|
|
21595
21609
|
// 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
|
|
21596
21610
|
funcSetNewTabLink = link => `/${appCodeLowerCase}${link}`;
|
|
21597
21611
|
}
|
|
21598
|
-
this._menuService.renderMenuByAppCode(appCode);
|
|
21612
|
+
this._menuService.renderMenuByAppCode(this.environment.scopeName, appCode);
|
|
21599
21613
|
this.model = this._menuService.getMenuItems();
|
|
21600
21614
|
this._router.events.pipe(filter(event => event instanceof NavigationEnd))
|
|
21601
21615
|
.subscribe(event => {
|
|
@@ -23951,7 +23965,7 @@ ReportQueueComponent.propDecorators = {
|
|
|
23951
23965
|
};
|
|
23952
23966
|
|
|
23953
23967
|
class CommonAppComponentComponent {
|
|
23954
|
-
constructor(_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) {
|
|
23968
|
+
constructor(_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) {
|
|
23955
23969
|
this._globalService = _globalService;
|
|
23956
23970
|
this._commonService = _commonService;
|
|
23957
23971
|
this.renderer = renderer;
|
|
@@ -23980,6 +23994,7 @@ class CommonAppComponentComponent {
|
|
|
23980
23994
|
this._menuService = _menuService;
|
|
23981
23995
|
this._primengConfig = _primengConfig;
|
|
23982
23996
|
this._storageService = _storageService;
|
|
23997
|
+
this._permissionService = _permissionService;
|
|
23983
23998
|
this.showQuickNote = true;
|
|
23984
23999
|
this.allowAnonymous = false;
|
|
23985
24000
|
this._unsubscribeAll = new Subject();
|
|
@@ -24132,6 +24147,15 @@ class CommonAppComponentComponent {
|
|
|
24132
24147
|
root.data.allowAnonymous = this.allowAnonymous;
|
|
24133
24148
|
// get current User
|
|
24134
24149
|
this._userService.populateCurrentUser();
|
|
24150
|
+
this._componentContextService.subscribe(ComCtxConstants.ROOT.NEED_CLEAR_PERMISSION_CACHE, () => __awaiter(this, void 0, void 0, function* () {
|
|
24151
|
+
if (this.environment.authenticationSettings.coreVersion == 'v4') {
|
|
24152
|
+
const clear = yield this.clearPermissionCacheByModule();
|
|
24153
|
+
if (!clear.success) {
|
|
24154
|
+
this._notifierService.showWarning('Có vấn đề trong lúc clear cache quyền');
|
|
24155
|
+
}
|
|
24156
|
+
}
|
|
24157
|
+
this._applicationContext.getRootContext().fireReplayEvent(ComCtxConstants.ROOT.USER_LOADED);
|
|
24158
|
+
}));
|
|
24135
24159
|
this._componentContextService.subscribe(ComCtxConstants.ROOT.KEY_DOWN_ARROWLEFT, (e) => {
|
|
24136
24160
|
if (document.activeElement === this.cancelButton.nativeElement) {
|
|
24137
24161
|
this.okButton.nativeElement.focus();
|
|
@@ -24636,6 +24660,17 @@ class CommonAppComponentComponent {
|
|
|
24636
24660
|
}
|
|
24637
24661
|
}
|
|
24638
24662
|
}
|
|
24663
|
+
clearPermissionCacheByModule() {
|
|
24664
|
+
let appSwitcher = this._moduleConfigService.getConfig().environment.appMetadata.appSwitcher;
|
|
24665
|
+
if (!appSwitcher || !appSwitcher.length) {
|
|
24666
|
+
appSwitcher = [];
|
|
24667
|
+
}
|
|
24668
|
+
let lstModule = appSwitcher.map(x => x.code);
|
|
24669
|
+
if (!lstModule) {
|
|
24670
|
+
lstModule = [];
|
|
24671
|
+
}
|
|
24672
|
+
return this._permissionService.clearPermissionCache(lstModule);
|
|
24673
|
+
}
|
|
24639
24674
|
}
|
|
24640
24675
|
CommonAppComponentComponent.decorators = [
|
|
24641
24676
|
{ type: Component, args: [{
|
|
@@ -24673,7 +24708,8 @@ CommonAppComponentComponent.ctorParameters = () => [
|
|
|
24673
24708
|
{ type: ConfirmationService },
|
|
24674
24709
|
{ type: MenuService },
|
|
24675
24710
|
{ type: PrimeNGConfig },
|
|
24676
|
-
{ type: StorageService }
|
|
24711
|
+
{ type: StorageService },
|
|
24712
|
+
{ type: PermissionService }
|
|
24677
24713
|
];
|
|
24678
24714
|
CommonAppComponentComponent.propDecorators = {
|
|
24679
24715
|
okButton: [{ type: ViewChild, args: ['okButton',] }],
|