SUPPORT-9324: использую кеш с добавлением id пользователя

This commit is contained in:
adel.ka 2025-08-15 21:01:32 +03:00
parent c0918a0be7
commit f045772222
2 changed files with 33 additions and 2 deletions

View file

@ -7,7 +7,7 @@ import {AgGridModule} from "ag-grid-angular";
import {
BpmnModule,
ComponentsModule,
CoreModule,
CoreModule, LocalStorageService,
ProgressIndicationService,
SecurityModule
} from "@webbpm/base-package";
@ -26,6 +26,7 @@ import {DropdownTreeviewSelectComponent} from "../../account_applications/compon
import {TreeviewModule} from "ngx-treeview";
import {ErvuStaticGrid} from "../../account_applications/component/grid/ErvuStaticGrid";
import {AuthorizationService} from "./service/authorization.service";
import {UserScopeLocalStorageService} from "./service/user-scope-local-storage.service";
registerLocaleData(localeRu);
export const DIRECTIVES = [
@ -62,7 +63,14 @@ export const DIRECTIVES = [
],
providers: [
TokenInterceptor, AuthorizationService,
{provide: ProgressIndicationService, useClass: AppProgressIndicationService }
{
provide: ProgressIndicationService,
useClass: AppProgressIndicationService
},
{
provide: LocalStorageService,
useClass: UserScopeLocalStorageService
}
],
bootstrap: [],
entryComponents: [AppProgressIndicationComponent]

View file

@ -0,0 +1,23 @@
import {LocalStorageService, WebbpmStorage} from "@webbpm/base-package";
import {AuthorizationService} from "./authorization.service";
import {Injectable} from "@angular/core";
@Injectable({providedIn: 'root'})
export class UserScopeLocalStorageService extends LocalStorageService {
constructor(protected authService: AuthorizationService) {
super();
}
readWebbpmStorage(storageId: string): WebbpmStorage {
const userId: string = this.authService.getUserId();
const userStorageId = `user_${userId}_${storageId}`;
return super.readWebbpmStorage(userStorageId);
}
readTemporalWebbpmStorage(storageId: string): WebbpmStorage {
const userId: string = this.authService.getUserId();
const userStorageId = `user_${userId}_${storageId}`;
return super.readTemporalWebbpmStorage(userStorageId);
}
}