diff --git a/frontend/src/ts/modules/app/app.module.ts b/frontend/src/ts/modules/app/app.module.ts index bd4b314f..92a9917a 100644 --- a/frontend/src/ts/modules/app/app.module.ts +++ b/frontend/src/ts/modules/app/app.module.ts @@ -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] diff --git a/frontend/src/ts/modules/app/service/user-scope-local-storage.service.ts b/frontend/src/ts/modules/app/service/user-scope-local-storage.service.ts new file mode 100644 index 00000000..e5d28d99 --- /dev/null +++ b/frontend/src/ts/modules/app/service/user-scope-local-storage.service.ts @@ -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); + } +} \ No newline at end of file