@spotto/semantic-query 1.0.70-alpha.39 → 1.0.70-alpha.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dates.d.ts +32 -32
- package/dist/dates.js +104 -104
- package/dist/evaluate.d.ts +35 -35
- package/dist/evaluate.js +587 -587
- package/dist/fixtures.d.ts +277 -277
- package/dist/fixtures.js +175 -175
- package/dist/index.d.ts +33 -33
- package/dist/index.js +49 -49
- package/dist/resolve-name.d.ts +9 -9
- package/dist/resolve-name.js +90 -90
- package/dist/rules-fixtures.d.ts +673 -673
- package/dist/rules-fixtures.js +405 -405
- package/dist/rules.d.ts +180 -180
- package/dist/rules.js +321 -321
- package/dist/suggest.d.ts +12 -12
- package/dist/suggest.js +69 -69
- package/dist/types.d.ts +111 -111
- package/dist/types.js +23 -23
- package/dist/validate.d.ts +33 -33
- package/dist/validate.js +822 -822
- package/package.json +3 -3
package/dist/rules.d.ts
CHANGED
|
@@ -1,180 +1,180 @@
|
|
|
1
|
-
import { ActionAccess, AssetAccessLevel, AssetAccessRule, AssetRuleConditions, FieldAccess, PermissionGrantLevel, SemanticQuery } from '@spotto/contract';
|
|
2
|
-
import { SemanticAccountSchema, SemanticCompileOptions, SemanticFieldDef } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* The group permission model as pure functions, called by the API and by the
|
|
5
|
-
* client so that neither holds an opinion of its own about who sees what.
|
|
6
|
-
*
|
|
7
|
-
* Specification: business_unit_access/group_permission_spec_v31.md, section 4.
|
|
8
|
-
* The section numbers beside each function are its. Nothing here reads a
|
|
9
|
-
* database or a store: the caller hands in the groups, an asset document in
|
|
10
|
-
* the server's shape (the client maps through `toEvaluableAsset` first, as it
|
|
11
|
-
* does for every semantic query) and the catalogue the evaluator already
|
|
12
|
-
* takes.
|
|
13
|
-
*
|
|
14
|
-
* The one rule everything below rests on: a group only ever grants. Removing a
|
|
15
|
-
* member, a grant or a group never widens what anyone sees, and adding one
|
|
16
|
-
* never narrows what anyone else has.
|
|
17
|
-
*/
|
|
18
|
-
declare type AssetDocument = Record<string, any>;
|
|
19
|
-
/** A group as the model sees it: its rule and its action access, nothing else. */
|
|
20
|
-
export interface AccessGroup {
|
|
21
|
-
id: string;
|
|
22
|
-
name?: string;
|
|
23
|
-
assetAccessRules: AssetAccessRule[];
|
|
24
|
-
actionAccess?: ActionAccess;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The caller, as resolved by whoever holds the session: the server from the
|
|
28
|
-
* request, the client from the current user record.
|
|
29
|
-
*/
|
|
30
|
-
export interface AccessCaller {
|
|
31
|
-
/**
|
|
32
|
-
* The model does not apply on either axis: the toggle is off, the request
|
|
33
|
-
* carried an API key, or the caller acts across organisations. Every answer
|
|
34
|
-
* is open.
|
|
35
|
-
*/
|
|
36
|
-
open?: boolean;
|
|
37
|
-
/** The role carries the exemption literal: asset rules do not apply. Field and action access still follow the groups. */
|
|
38
|
-
exempt?: boolean;
|
|
39
|
-
/** The role carries `fields:admin`: every custom field, at the asset's level. */
|
|
40
|
-
fieldsAdmin?: boolean;
|
|
41
|
-
/** The role carries `actions:admin`: every action. */
|
|
42
|
-
actionsAdmin?: boolean;
|
|
43
|
-
groups: ReadonlyArray<AccessGroup>;
|
|
44
|
-
}
|
|
45
|
-
declare type ConditionedRule = AssetAccessRule & {
|
|
46
|
-
conditions: AssetRuleConditions;
|
|
47
|
-
};
|
|
48
|
-
declare type FieldCatalogue = ReadonlyArray<Pick<SemanticFieldDef, 'id' | 'name'>>;
|
|
49
|
-
/** The less permissive of two levels. */
|
|
50
|
-
export declare function lowerLevel(a: PermissionGrantLevel, b: PermissionGrantLevel): PermissionGrantLevel;
|
|
51
|
-
/** The more permissive of two levels. */
|
|
52
|
-
export declare function higherLevel(a: PermissionGrantLevel, b: PermissionGrantLevel): PermissionGrantLevel;
|
|
53
|
-
/** The group's rule: one per group in this release. */
|
|
54
|
-
export declare function ruleOf(group: AccessGroup): AssetAccessRule | undefined;
|
|
55
|
-
export declare function ruleHasConditions(rule: AssetAccessRule): rule is ConditionedRule;
|
|
56
|
-
/** A conditions rule's level. The validator requires it; a stored rule without one reads as VIEW, the narrower answer. */
|
|
57
|
-
export declare function ruleLevel(rule: AssetAccessRule): AssetAccessLevel;
|
|
58
|
-
/**
|
|
59
|
-
* Unlimited: conditions present, locations and asset types both at ALL and no
|
|
60
|
-
* custom-field filter. Such a rule grants every asset. A rule-less group is
|
|
61
|
-
* not unlimited, because it grants no assets at all. Section 2.
|
|
62
|
-
*/
|
|
63
|
-
export declare function ruleIsUnlimited(rule: AssetAccessRule): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* A path with its trailing pipe. The validators store the canonical form; this
|
|
66
|
-
* guards a document written before them, exactly as the old scope resolver
|
|
67
|
-
* did at match time.
|
|
68
|
-
*/
|
|
69
|
-
export declare function canonicalAccessPath(path: string): string;
|
|
70
|
-
/**
|
|
71
|
-
* Section 4.1: a rule's conditions as a semantic query.
|
|
72
|
-
*
|
|
73
|
-
* locations SELECTED -> or[ per path: homeLocation subtree, location subtree ]
|
|
74
|
-
* assetTypes SELECTED -> or[ per path: assetType subtree ]
|
|
75
|
-
* each filter -> or[ per value: customField eq value ]
|
|
76
|
-
* rule -> and of every present dimension (the query's top level)
|
|
77
|
-
*
|
|
78
|
-
* Every condition kind here already exists in the evaluator and in both
|
|
79
|
-
* compilers, so the translation adds no form to any of them. The language
|
|
80
|
-
* keys a custom field by name, so the field id is resolved through the
|
|
81
|
-
* catalogue the caller already holds.
|
|
82
|
-
*
|
|
83
|
-
* Returns undefined when the rule contributes nothing: it has no conditions
|
|
84
|
-
* (a rule-less group), a SELECTED dimension names no path, or a filter names
|
|
85
|
-
* a field the catalogue lacks or no value. The propagation rules keep the
|
|
86
|
-
* last two from being stored; if one is met anyway the rule grants nothing
|
|
87
|
-
* rather than everything.
|
|
88
|
-
*/
|
|
89
|
-
export declare function ruleToQuery(rule: AssetAccessRule, fields: FieldCatalogue): SemanticQuery | undefined;
|
|
90
|
-
/**
|
|
91
|
-
* What a list surface applies. `unfiltered` for the open callers, the exempt
|
|
92
|
-
* role and a caller with an unlimited rule. `none` for a caller whose groups
|
|
93
|
-
* carry no rule with conditions, who sees nothing. Otherwise the OR of the
|
|
94
|
-
* rule queries, with a flag saying whether it reads custom fields, which is
|
|
95
|
-
* what decides the type join on the server and the catalogue load on the
|
|
96
|
-
* client.
|
|
97
|
-
*/
|
|
98
|
-
export declare type ScopeQuery = {
|
|
99
|
-
kind: 'unfiltered';
|
|
100
|
-
} | {
|
|
101
|
-
kind: 'none';
|
|
102
|
-
} | {
|
|
103
|
-
kind: 'query';
|
|
104
|
-
query: SemanticQuery;
|
|
105
|
-
usesCustomFields: boolean;
|
|
106
|
-
};
|
|
107
|
-
export declare function scopeQueryFor(caller: AccessCaller, fields: FieldCatalogue): ScopeQuery;
|
|
108
|
-
/** The union of the location dimensions, which the location list, its map and the child lists follow. */
|
|
109
|
-
export declare type LocationUnion = {
|
|
110
|
-
all: true;
|
|
111
|
-
} | {
|
|
112
|
-
all: false;
|
|
113
|
-
paths: string[];
|
|
114
|
-
};
|
|
115
|
-
export declare function locationUnionFor(caller: AccessCaller): LocationUnion;
|
|
116
|
-
/**
|
|
117
|
-
* Section 2, location limit: not open or exempt, and no conditions group with
|
|
118
|
-
* locations at ALL. A caller in no group has one, since their union is empty.
|
|
119
|
-
*/
|
|
120
|
-
export declare function hasLocationLimit(caller: AccessCaller): boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Section 2, unconfined: open or exempt, or a member of a group whose rule is
|
|
123
|
-
* unlimited. Only unconfined callers administer groups and memberships.
|
|
124
|
-
*/
|
|
125
|
-
export declare function isUnconfined(caller: AccessCaller): boolean;
|
|
126
|
-
/** The answers the detail and edit pages, the CSV cells and the warnings need for one asset. */
|
|
127
|
-
export interface AssetAccess {
|
|
128
|
-
visible: boolean;
|
|
129
|
-
editable: boolean;
|
|
130
|
-
/** EDIT, VIEW or NONE. An asset at NONE still opens by scan, link, kit or history. */
|
|
131
|
-
level: PermissionGrantLevel;
|
|
132
|
-
/** The caller's groups with conditions whose rule matches the asset. */
|
|
133
|
-
matching: AccessGroup[];
|
|
134
|
-
/** Section 4.4, for one custom field. */
|
|
135
|
-
fieldLevel(fieldId: string): PermissionGrantLevel;
|
|
136
|
-
}
|
|
137
|
-
/** The asset level over the groups that match it. */
|
|
138
|
-
export declare function assetLevelFor(caller: AccessCaller, matching: AccessGroup[]): PermissionGrantLevel;
|
|
139
|
-
/** What a field access grants on one field: `ALL` its level, `SELECTED` the entry's level or NONE. */
|
|
140
|
-
export declare function fieldGrantLevel(fieldAccess: FieldAccess, fieldId: string): PermissionGrantLevel;
|
|
141
|
-
/**
|
|
142
|
-
* Section 4.4. The cap is the asset level, or VIEW when that is NONE, since
|
|
143
|
-
* any asset can be opened. Open callers and the field-admin bypass get the
|
|
144
|
-
* cap. Otherwise each group contributes: a matching conditions group its
|
|
145
|
-
* grant capped at its rule's level, a rule-less group its grant capped at the
|
|
146
|
-
* cap, and the most permissive contribution wins.
|
|
147
|
-
*/
|
|
148
|
-
export declare function fieldLevelFor(caller: AccessCaller, matching: AccessGroup[], assetLevel: PermissionGrantLevel, fieldId: string): PermissionGrantLevel;
|
|
149
|
-
/**
|
|
150
|
-
* Whether the caller can see the field on SOME asset: the test for a column
|
|
151
|
-
* or a picker entry (section 6.1 `canViewFieldAnywhere`, section 5.4 for the
|
|
152
|
-
* CSV columns). Open callers and the field-admin bypass see every column.
|
|
153
|
-
*/
|
|
154
|
-
export declare function canViewFieldAnywhere(caller: AccessCaller, fieldId: string): boolean;
|
|
155
|
-
/**
|
|
156
|
-
* The evaluator prepared once for a caller: one predicate per conditions
|
|
157
|
-
* group, built against the catalogue, then applied to any number of assets.
|
|
158
|
-
* The CSV export and the client's lists go through this; a single detail page
|
|
159
|
-
* may call `accessFor` directly.
|
|
160
|
-
*/
|
|
161
|
-
export interface PreparedAccess {
|
|
162
|
-
scope: ScopeQuery;
|
|
163
|
-
locationUnion: LocationUnion;
|
|
164
|
-
unconfined: boolean;
|
|
165
|
-
accessFor(asset: AssetDocument): AssetAccess;
|
|
166
|
-
}
|
|
167
|
-
export declare function prepareAccess(caller: AccessCaller, schema: SemanticAccountSchema, opts?: SemanticCompileOptions): PreparedAccess;
|
|
168
|
-
/** One asset, one answer. Prefer `prepareAccess` when evaluating many. */
|
|
169
|
-
export declare function accessFor(caller: AccessCaller, asset: AssetDocument, schema: SemanticAccountSchema, opts?: SemanticCompileOptions): AssetAccess;
|
|
170
|
-
export declare function groupGrantsAction(group: AccessGroup, actionId: string): boolean;
|
|
171
|
-
/** Whether every action is usable: the open callers, the action-admin bypass, or an All actions group. */
|
|
172
|
-
export declare function grantsEveryAction(caller: AccessCaller): boolean;
|
|
173
|
-
export declare function canUseAction(caller: AccessCaller, actionId: string): boolean;
|
|
174
|
-
/**
|
|
175
|
-
* The complete list the current user record carries, in the order of the
|
|
176
|
-
* organisation's actions, so a Selected id that no longer exists never
|
|
177
|
-
* appears.
|
|
178
|
-
*/
|
|
179
|
-
export declare function usableActionIds(caller: AccessCaller, organisationActionIds: ReadonlyArray<string>): string[];
|
|
180
|
-
export {};
|
|
1
|
+
import { ActionAccess, AssetAccessLevel, AssetAccessRule, AssetRuleConditions, FieldAccess, PermissionGrantLevel, SemanticQuery } from '@spotto/contract';
|
|
2
|
+
import { SemanticAccountSchema, SemanticCompileOptions, SemanticFieldDef } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The group permission model as pure functions, called by the API and by the
|
|
5
|
+
* client so that neither holds an opinion of its own about who sees what.
|
|
6
|
+
*
|
|
7
|
+
* Specification: business_unit_access/group_permission_spec_v31.md, section 4.
|
|
8
|
+
* The section numbers beside each function are its. Nothing here reads a
|
|
9
|
+
* database or a store: the caller hands in the groups, an asset document in
|
|
10
|
+
* the server's shape (the client maps through `toEvaluableAsset` first, as it
|
|
11
|
+
* does for every semantic query) and the catalogue the evaluator already
|
|
12
|
+
* takes.
|
|
13
|
+
*
|
|
14
|
+
* The one rule everything below rests on: a group only ever grants. Removing a
|
|
15
|
+
* member, a grant or a group never widens what anyone sees, and adding one
|
|
16
|
+
* never narrows what anyone else has.
|
|
17
|
+
*/
|
|
18
|
+
declare type AssetDocument = Record<string, any>;
|
|
19
|
+
/** A group as the model sees it: its rule and its action access, nothing else. */
|
|
20
|
+
export interface AccessGroup {
|
|
21
|
+
id: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
assetAccessRules: AssetAccessRule[];
|
|
24
|
+
actionAccess?: ActionAccess;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The caller, as resolved by whoever holds the session: the server from the
|
|
28
|
+
* request, the client from the current user record.
|
|
29
|
+
*/
|
|
30
|
+
export interface AccessCaller {
|
|
31
|
+
/**
|
|
32
|
+
* The model does not apply on either axis: the toggle is off, the request
|
|
33
|
+
* carried an API key, or the caller acts across organisations. Every answer
|
|
34
|
+
* is open.
|
|
35
|
+
*/
|
|
36
|
+
open?: boolean;
|
|
37
|
+
/** The role carries the exemption literal: asset rules do not apply. Field and action access still follow the groups. */
|
|
38
|
+
exempt?: boolean;
|
|
39
|
+
/** The role carries `fields:admin`: every custom field, at the asset's level. */
|
|
40
|
+
fieldsAdmin?: boolean;
|
|
41
|
+
/** The role carries `actions:admin`: every action. */
|
|
42
|
+
actionsAdmin?: boolean;
|
|
43
|
+
groups: ReadonlyArray<AccessGroup>;
|
|
44
|
+
}
|
|
45
|
+
declare type ConditionedRule = AssetAccessRule & {
|
|
46
|
+
conditions: AssetRuleConditions;
|
|
47
|
+
};
|
|
48
|
+
declare type FieldCatalogue = ReadonlyArray<Pick<SemanticFieldDef, 'id' | 'name'>>;
|
|
49
|
+
/** The less permissive of two levels. */
|
|
50
|
+
export declare function lowerLevel(a: PermissionGrantLevel, b: PermissionGrantLevel): PermissionGrantLevel;
|
|
51
|
+
/** The more permissive of two levels. */
|
|
52
|
+
export declare function higherLevel(a: PermissionGrantLevel, b: PermissionGrantLevel): PermissionGrantLevel;
|
|
53
|
+
/** The group's rule: one per group in this release. */
|
|
54
|
+
export declare function ruleOf(group: AccessGroup): AssetAccessRule | undefined;
|
|
55
|
+
export declare function ruleHasConditions(rule: AssetAccessRule): rule is ConditionedRule;
|
|
56
|
+
/** A conditions rule's level. The validator requires it; a stored rule without one reads as VIEW, the narrower answer. */
|
|
57
|
+
export declare function ruleLevel(rule: AssetAccessRule): AssetAccessLevel;
|
|
58
|
+
/**
|
|
59
|
+
* Unlimited: conditions present, locations and asset types both at ALL and no
|
|
60
|
+
* custom-field filter. Such a rule grants every asset. A rule-less group is
|
|
61
|
+
* not unlimited, because it grants no assets at all. Section 2.
|
|
62
|
+
*/
|
|
63
|
+
export declare function ruleIsUnlimited(rule: AssetAccessRule): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* A path with its trailing pipe. The validators store the canonical form; this
|
|
66
|
+
* guards a document written before them, exactly as the old scope resolver
|
|
67
|
+
* did at match time.
|
|
68
|
+
*/
|
|
69
|
+
export declare function canonicalAccessPath(path: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Section 4.1: a rule's conditions as a semantic query.
|
|
72
|
+
*
|
|
73
|
+
* locations SELECTED -> or[ per path: homeLocation subtree, location subtree ]
|
|
74
|
+
* assetTypes SELECTED -> or[ per path: assetType subtree ]
|
|
75
|
+
* each filter -> or[ per value: customField eq value ]
|
|
76
|
+
* rule -> and of every present dimension (the query's top level)
|
|
77
|
+
*
|
|
78
|
+
* Every condition kind here already exists in the evaluator and in both
|
|
79
|
+
* compilers, so the translation adds no form to any of them. The language
|
|
80
|
+
* keys a custom field by name, so the field id is resolved through the
|
|
81
|
+
* catalogue the caller already holds.
|
|
82
|
+
*
|
|
83
|
+
* Returns undefined when the rule contributes nothing: it has no conditions
|
|
84
|
+
* (a rule-less group), a SELECTED dimension names no path, or a filter names
|
|
85
|
+
* a field the catalogue lacks or no value. The propagation rules keep the
|
|
86
|
+
* last two from being stored; if one is met anyway the rule grants nothing
|
|
87
|
+
* rather than everything.
|
|
88
|
+
*/
|
|
89
|
+
export declare function ruleToQuery(rule: AssetAccessRule, fields: FieldCatalogue): SemanticQuery | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* What a list surface applies. `unfiltered` for the open callers, the exempt
|
|
92
|
+
* role and a caller with an unlimited rule. `none` for a caller whose groups
|
|
93
|
+
* carry no rule with conditions, who sees nothing. Otherwise the OR of the
|
|
94
|
+
* rule queries, with a flag saying whether it reads custom fields, which is
|
|
95
|
+
* what decides the type join on the server and the catalogue load on the
|
|
96
|
+
* client.
|
|
97
|
+
*/
|
|
98
|
+
export declare type ScopeQuery = {
|
|
99
|
+
kind: 'unfiltered';
|
|
100
|
+
} | {
|
|
101
|
+
kind: 'none';
|
|
102
|
+
} | {
|
|
103
|
+
kind: 'query';
|
|
104
|
+
query: SemanticQuery;
|
|
105
|
+
usesCustomFields: boolean;
|
|
106
|
+
};
|
|
107
|
+
export declare function scopeQueryFor(caller: AccessCaller, fields: FieldCatalogue): ScopeQuery;
|
|
108
|
+
/** The union of the location dimensions, which the location list, its map and the child lists follow. */
|
|
109
|
+
export declare type LocationUnion = {
|
|
110
|
+
all: true;
|
|
111
|
+
} | {
|
|
112
|
+
all: false;
|
|
113
|
+
paths: string[];
|
|
114
|
+
};
|
|
115
|
+
export declare function locationUnionFor(caller: AccessCaller): LocationUnion;
|
|
116
|
+
/**
|
|
117
|
+
* Section 2, location limit: not open or exempt, and no conditions group with
|
|
118
|
+
* locations at ALL. A caller in no group has one, since their union is empty.
|
|
119
|
+
*/
|
|
120
|
+
export declare function hasLocationLimit(caller: AccessCaller): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Section 2, unconfined: open or exempt, or a member of a group whose rule is
|
|
123
|
+
* unlimited. Only unconfined callers administer groups and memberships.
|
|
124
|
+
*/
|
|
125
|
+
export declare function isUnconfined(caller: AccessCaller): boolean;
|
|
126
|
+
/** The answers the detail and edit pages, the CSV cells and the warnings need for one asset. */
|
|
127
|
+
export interface AssetAccess {
|
|
128
|
+
visible: boolean;
|
|
129
|
+
editable: boolean;
|
|
130
|
+
/** EDIT, VIEW or NONE. An asset at NONE still opens by scan, link, kit or history. */
|
|
131
|
+
level: PermissionGrantLevel;
|
|
132
|
+
/** The caller's groups with conditions whose rule matches the asset. */
|
|
133
|
+
matching: AccessGroup[];
|
|
134
|
+
/** Section 4.4, for one custom field. */
|
|
135
|
+
fieldLevel(fieldId: string): PermissionGrantLevel;
|
|
136
|
+
}
|
|
137
|
+
/** The asset level over the groups that match it. */
|
|
138
|
+
export declare function assetLevelFor(caller: AccessCaller, matching: AccessGroup[]): PermissionGrantLevel;
|
|
139
|
+
/** What a field access grants on one field: `ALL` its level, `SELECTED` the entry's level or NONE. */
|
|
140
|
+
export declare function fieldGrantLevel(fieldAccess: FieldAccess, fieldId: string): PermissionGrantLevel;
|
|
141
|
+
/**
|
|
142
|
+
* Section 4.4. The cap is the asset level, or VIEW when that is NONE, since
|
|
143
|
+
* any asset can be opened. Open callers and the field-admin bypass get the
|
|
144
|
+
* cap. Otherwise each group contributes: a matching conditions group its
|
|
145
|
+
* grant capped at its rule's level, a rule-less group its grant capped at the
|
|
146
|
+
* cap, and the most permissive contribution wins.
|
|
147
|
+
*/
|
|
148
|
+
export declare function fieldLevelFor(caller: AccessCaller, matching: AccessGroup[], assetLevel: PermissionGrantLevel, fieldId: string): PermissionGrantLevel;
|
|
149
|
+
/**
|
|
150
|
+
* Whether the caller can see the field on SOME asset: the test for a column
|
|
151
|
+
* or a picker entry (section 6.1 `canViewFieldAnywhere`, section 5.4 for the
|
|
152
|
+
* CSV columns). Open callers and the field-admin bypass see every column.
|
|
153
|
+
*/
|
|
154
|
+
export declare function canViewFieldAnywhere(caller: AccessCaller, fieldId: string): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* The evaluator prepared once for a caller: one predicate per conditions
|
|
157
|
+
* group, built against the catalogue, then applied to any number of assets.
|
|
158
|
+
* The CSV export and the client's lists go through this; a single detail page
|
|
159
|
+
* may call `accessFor` directly.
|
|
160
|
+
*/
|
|
161
|
+
export interface PreparedAccess {
|
|
162
|
+
scope: ScopeQuery;
|
|
163
|
+
locationUnion: LocationUnion;
|
|
164
|
+
unconfined: boolean;
|
|
165
|
+
accessFor(asset: AssetDocument): AssetAccess;
|
|
166
|
+
}
|
|
167
|
+
export declare function prepareAccess(caller: AccessCaller, schema: SemanticAccountSchema, opts?: SemanticCompileOptions): PreparedAccess;
|
|
168
|
+
/** One asset, one answer. Prefer `prepareAccess` when evaluating many. */
|
|
169
|
+
export declare function accessFor(caller: AccessCaller, asset: AssetDocument, schema: SemanticAccountSchema, opts?: SemanticCompileOptions): AssetAccess;
|
|
170
|
+
export declare function groupGrantsAction(group: AccessGroup, actionId: string): boolean;
|
|
171
|
+
/** Whether every action is usable: the open callers, the action-admin bypass, or an All actions group. */
|
|
172
|
+
export declare function grantsEveryAction(caller: AccessCaller): boolean;
|
|
173
|
+
export declare function canUseAction(caller: AccessCaller, actionId: string): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* The complete list the current user record carries, in the order of the
|
|
176
|
+
* organisation's actions, so a Selected id that no longer exists never
|
|
177
|
+
* appears.
|
|
178
|
+
*/
|
|
179
|
+
export declare function usableActionIds(caller: AccessCaller, organisationActionIds: ReadonlyArray<string>): string[];
|
|
180
|
+
export {};
|