刘光辉
3 小时以前 cf11e63b659afcc9792ab3e395f1b45d844431a8
1
2
3
4
5
6
7
8
9
10
11
12
export type FileAction = 'ADD' | 'DOWNLOAD' | 'EDIT' | 'REVIEW' | 'REMOVE' | 'REPLACE' | 'VIEW';
 
/** 只消费运行态裁决,不解释流程规则。未配置保持旧行为,受控但未就绪则关闭动作。 */
export interface FileAccess {
  reviewEnabled?: boolean;
  status: 'error' | 'loading' | 'ready';
  actions?: Partial<Record<FileAction, boolean>>;
}
 
export function allowsFileAction(access: FileAccess | undefined, action: FileAction): boolean {
  return access === undefined || (access?.status === 'ready' && access.actions?.[action] === true);
}