File

libs/acl/src/lib/acl-engine/types.ts

Index

Properties

Properties

active
Type boolean
condition
Type string
defaultRule
Type boolean
dynamicFormRule (Optional)
Type boolean
path
Type string
state
Type AclRuleState
import { Observable } from 'rxjs';

export const aclResourceStates = ['hidden', 'readonly', 'disabled'] as const;
export type AclResourceState = (typeof aclResourceStates)[number];

export const aclResetStates = ['visible', 'editable'] as const;
export type AclResetState = (typeof aclResetStates)[number];

export const aclRuleStates = [...aclResetStates, ...aclResourceStates] as const;
export type AclRuleState = AclResetState | AclResourceState;

export interface AclRule {
  active: boolean;
  path: string;
  condition: string;
  state: AclRuleState;
  defaultRule: boolean;
  dynamicFormRule?: boolean;
}

export interface AclDecision {
  path: string;
  state: AclRuleState;
  decision: boolean;
  timestamp: number;
}

export interface ExpressionStoreAdapter {
  readonly dataChanged$: Observable<unknown>;
  queryStoreValue(path: string): unknown;
}

/**
 * This is our main agreement on how to consume acl in an application.
 */
export interface AclEvaluationInterface {
  readonly unscoped: AclEvaluationInterface;

  /**
   * @deprecated
   */
  canShow(aclPath: string): boolean;
  /**
   * @deprecated
   */
  canShow$(aclPath: string): Observable<boolean>;

  canEdit(aclPath: string): boolean;
  canEdit$(aclPath: string): Observable<boolean>;

  isReadonly(aclPath: string): boolean;
  isReadonly$(aclPath: string): Observable<boolean>;

  isDisabled(aclPath: string): boolean;
  isDisabled$(aclPath: string): Observable<boolean>;

  isHidden(aclPath: string): boolean;
  isHidden$(aclPath: string): Observable<boolean>;
}

results matching ""

    No results matching ""