2021-12-07 11:21:16 +00:00
|
|
|
import {PartialPermissionSet} from 'app/common/ACLPermissions';
|
|
|
|
import {CellValue, RowRecord} from 'app/common/DocActions';
|
2024-04-26 20:34:16 +00:00
|
|
|
import {CompiledPredicateFormula} from 'app/common/PredicateFormula';
|
2021-12-07 11:21:16 +00:00
|
|
|
import {MetaRowRecord} from 'app/common/TableData';
|
2020-10-19 14:25:21 +00:00
|
|
|
|
2020-11-17 21:49:32 +00:00
|
|
|
export interface RuleSet {
|
|
|
|
tableId: '*' | string;
|
|
|
|
colIds: '*' | string[];
|
2020-12-04 23:29:29 +00:00
|
|
|
// The default permissions for this resource, if set, are represented by a RulePart with
|
|
|
|
// aclFormula of "", which must be the last element of body.
|
2020-11-17 21:49:32 +00:00
|
|
|
body: RulePart[];
|
2020-10-12 13:50:07 +00:00
|
|
|
}
|
|
|
|
|
2020-11-17 21:49:32 +00:00
|
|
|
export interface RulePart {
|
2021-12-07 11:21:16 +00:00
|
|
|
origRecord?: MetaRowRecord<'_grist_ACLRules'>; // Original record used to create this RulePart.
|
2020-11-17 21:49:32 +00:00
|
|
|
aclFormula: string;
|
|
|
|
permissions: PartialPermissionSet;
|
|
|
|
permissionsText: string; // The text version of PermissionSet, as stored.
|
|
|
|
|
|
|
|
// Compiled version of aclFormula.
|
2024-04-26 20:34:16 +00:00
|
|
|
matchFunc?: CompiledPredicateFormula;
|
2021-02-15 21:36:33 +00:00
|
|
|
|
|
|
|
// Optional memo, currently extracted from comment in formula.
|
|
|
|
memo?: string;
|
2020-10-12 13:50:07 +00:00
|
|
|
}
|
|
|
|
|
2021-03-01 16:51:30 +00:00
|
|
|
// As InfoView, but also supporting writing.
|
|
|
|
export interface InfoEditor {
|
|
|
|
get(key: string): CellValue;
|
|
|
|
set(key: string, val: CellValue): this;
|
|
|
|
toJSON(): {[key: string]: any};
|
|
|
|
}
|
|
|
|
|
2020-11-17 21:49:32 +00:00
|
|
|
export interface UserAttributeRule {
|
2020-12-04 23:29:29 +00:00
|
|
|
origRecord?: RowRecord; // Original record used to create this UserAttributeRule.
|
2020-11-17 21:49:32 +00:00
|
|
|
name: string; // Should be unique among UserAttributeRules.
|
|
|
|
tableId: string; // Table in which to look up an existing attribute.
|
|
|
|
lookupColId: string; // Column in tableId in which to do the lookup.
|
|
|
|
charId: string; // Attribute to look up, possibly a path. E.g. 'Email' or 'office.city'.
|
2020-10-19 14:25:21 +00:00
|
|
|
}
|