bpmn-server / SecurityPolicy
Class: SecurityPolicy#
The security policies of one models folder.
Table of contents#
Constructors#
Properties#
Accessors#
Methods#
- file
- seeQuery
- names
- model
- itemOf
- actorsOf
- decide
- data
- visibleData
- combine
- context
- whoMay
- ask
- builtInDefault
Constructors#
constructor#
• new SecurityPolicy(definitionsPath, appDelegate?): SecurityPolicy
appDelegate: the application's, for its decisionContext hook (engine/DecisionContext.ts)
Parameters#
| Name | Type |
|---|---|
definitionsPath |
string |
appDelegate? |
any |
Returns#
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:94
Properties#
models#
▪ Static Private models: Map\<string, { stamp: string ; model: IModelSecurity }>
models' security facts, by file, while the file is as it was (shared by every instance)
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:91
definitionsPath#
• Readonly definitionsPath: string
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:94
appDelegate#
• Optional Readonly appDelegate: any
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:94
Accessors#
on#
• get on(): boolean
Whether this folder's cases are decided by security policies.
Returns#
boolean
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:97
Methods#
file#
▸ file(name): string
A policy's file, or null when it isn't there.
Parameters#
| Name | Type |
|---|---|
name |
string |
Returns#
string
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:104
seeQuery#
▸ seeQuery(user, modelNames): Promise\<object>
The store's condition for the cases this user may see (SecurityQuery.ts): a superset, so a list reads fewer
cases before asking the policy for each; null when any case may be seen (no narrowing). modelNames: the
models whose own policy narrows its cases; any other case goes by the default's.
Parameters#
| Name | Type |
|---|---|
user |
ISecurityUser |
modelNames |
string[] |
Returns#
Promise\<object>
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:115
names#
▸ names(): string[]
The folder's policies, by name.
Returns#
string[]
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:134
model#
▸ model(modelName): IModelSecurity
A model's security facts, from its file.
Parameters#
| Name | Type |
|---|---|
modelName |
string |
Returns#
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:141
itemOf#
▸ itemOf(instance, task?): any
The task's item: by its id, else the element's waiting one, else its latest.
Parameters#
| Name | Type |
|---|---|
instance |
any |
task? |
ISecurityTask |
Returns#
any
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:174
actorsOf#
▸ actorsOf(instance, task?): Record\<string, Actor>
An instance's actors (engine/DecisionContext.ts), from its items and its model's owf:actor; for a task, those of its item's branch.
Parameters#
| Name | Type |
|---|---|
instance |
any |
task? |
ISecurityTask |
Returns#
Record\<string, Actor>
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:186
decide#
▸ decide(user, instance, task?, errors?): Promise\<IAccess>
What a person may do with a case (and, with task, one of its tasks): every rule of the policies that apply (the
process's, else the application's default, else the built-in one; and the task's own), combined. A policy that
can't be read decides nothing (its error is in errors), so what it would have allowed stays refused.
Parameters#
| Name | Type | Default value |
|---|---|---|
user |
ISecurityUser |
undefined |
instance |
any |
undefined |
task? |
ISecurityTask |
undefined |
errors |
string[] |
[] |
Returns#
Promise\<IAccess>
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:196
data#
▸ data(instance, access, taskElementId?): Record\<string, any>
A case's data as the access lets a person read it; for a task, its own form's fields too.
Parameters#
| Name | Type |
|---|---|
instance |
any |
access |
IAccess |
taskElementId? |
string |
Returns#
Record\<string, any>
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:219
visibleData#
▸ visibleData(data, access, formFields?, ownFields?): Record\<string, any>
These data as the access lets a person read them: what forms entered, these paths, and ownFields always.
Parameters#
| Name | Type |
|---|---|
data |
Record\<string, any> |
access |
IAccess |
formFields |
Set\<string> |
ownFields |
Set\<string> |
Returns#
Record\<string, any>
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:226
combine#
▸ combine(rules): IAccess
The matching rules' answers, combined: any deny wins; else what is allowed; else each action's default.
Parameters#
| Name | Type |
|---|---|
rules |
IPolicyRule[] |
Returns#
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:250
context#
▸ context(user, instance, task?): Promise\<Record\<string, any>>
What the policies' tables read: the names every expression reads (engine/DecisionContext.ts): the user, the actors, the task, the data (the instance's; a task's, its item's in its scope), the application's facts.
Parameters#
| Name | Type |
|---|---|
user |
ISecurityUser |
instance |
any |
task? |
ISecurityTask |
Returns#
Promise\<Record\<string, any>>
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:278
whoMay#
▸ whoMay(instance, «destructured»?): Promise\<IWhoMay[]>
The reverse of a policy, for one case: who may do what with it. Asked forward for everyone who could make a
difference: the people the case names (who started it, a task's assignee or candidates, who completed a step;
with users, everyone in the directory, with their groups), each role as a member with no relation to the case
(roles, and the groups its waiting tasks are offered to), and anyone else. Administrators (admins) are not
asked: they may do everything. For each, the case (see, data, restart, events) and each waiting user task: whether
they may claim, complete and assign it, the assignment's offer and the policy's allow or deny combined.
Parameters#
| Name | Type | Default value |
|---|---|---|
instance |
any |
undefined |
«destructured» |
Object |
{} |
› users? |
ISecurityUser[] |
[] |
› roles? |
string[] |
[] |
› admins? |
string[] |
[] |
Returns#
Promise\<IWhoMay[]>
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:295
ask#
▸ ask(file, context): Promise\<{ rule: number ; outputs: Record\<string, any> }[]>
One policy's matching rules, for this context.
Parameters#
| Name | Type |
|---|---|
file |
string |
context |
Record\<string, any> |
Returns#
Promise\<{ rule: number ; outputs: Record\<string, any> }[]>
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:359
builtInDefault#
▸ builtInDefault(user, instance, actors): { rule: number ; outputs: Record\<string, any> }[]
The built-in default, for a folder without default.dmn.xml (the Fable Review's H2): designers see every case
and its data; the assignee and candidates of a task see the case as a line, and what forms entered; who started
it or completed a step of it, as a line.
Parameters#
| Name | Type |
|---|---|
user |
ISecurityUser |
instance |
any |
actors |
Record\<string, Actor> |
Returns#
{ rule: number ; outputs: Record\<string, any> }[]
Defined in#
packages/bpmn-server/src/addons/security/SecurityPolicy.ts:371