File

libs/pfe-connector/src/lib/pfe-acl-expression-adapter.ts

Index

Properties
Accessors

Constructor

constructor(pfeStateService: PfeStateService)
Parameters :
Name Type Optional
pfeStateService PfeStateService No

Properties

queryStoreValue
Default value : () => {...}

Accessors

dataChanged$
getdataChanged$()

notify that some data in the store has changed so we can invalidate the acl rules.

import { PfeStateService } from '@allianz/ngx-pfe';
import { ExpressionStoreAdapter } from '@allianz/taly-acl';
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class PfeAclExpressionAdapter implements ExpressionStoreAdapter {
  private _dataChangedSubject = new Subject<void>();

  constructor(private pfeStateService: PfeStateService) {
    this.pfeStateService.pfeUserInputState$.subscribe(() => this.handleStateChanged());
  }

  queryStoreValue = (path: string) => {
    const value = this.pfeStateService.getStateValueByExpression(path);
    return value;
  };

  /**
   * notify that some data in the store has changed
   * so we can invalidate the acl rules.
   */
  get dataChanged$() {
    return this._dataChangedSubject.asObservable();
  }

  private handleStateChanged() {
    this._dataChangedSubject.next();
  }
}

results matching ""

    No results matching ""