PolicyCondition expressions

Table of contents

PolicyCondition expressions are used to reference Policy Conditions. They can return PolicyConditionAtomic, PolicyConditionComposite and PolicyConditionDefault entities. Parser command to be invoked is PEELParser(str).parseCondition() and it returns IPolicyCondition entity.

Command table

CommandTypeformatoptions 
*gtPolicyConditionAtomic*gt(<PolicyVariable|Reference>{2,2},#opts?)negateResult(*), stringIgnoreCase(*) 
*gtePolicyConditionAtomic*gte(<PolicyVariable|Reference>{2,2},#opts?)negateResult(*), stringIgnoreCase(*) 
*ltPolicyConditionAtomic*lt(<PolicyVariable|Reference>{2,2},#opts?)negateResult(*), stringIgnoreCase(*) 
*ltePolicyConditionAtomic*lte(<PolicyVariable|Reference>{2,2},#opts?)negateResult(*), stringIgnoreCase(*) 
*isNullPolicyConditionAtomic*isNull(<PolicyVariable|Reference>{1,1},#opts?)negateResult(*) 
*notNullPolicyConditionAtomic*notNull(<PolicyVariable|Reference>{1,1},#opts?)negateResult(*) 
*isEmptyPolicyConditionAtomic*isEmpty(<PolicyVariable|Reference>{1,1},#opts?)negateResult(*) 
*notEmptyPolicyConditionAtomic*notEmpty(<PolicyVariable|Reference>{1,1},#opts?)negateResult(*) 
*isBlankPolicyConditionAtomic*isBlank(<PolicyVariable|Reference>{1,1},#opts?)negateResult(*) 
*notBlankPolicyConditionAtomic*notBlank(<PolicyVariable|Reference>{1,1},#opts?)negateResult(*) 
*swPolicyConditionAtomic*sw(<PolicyVariable|Reference>{2,2},#opts?)negateResult(*), stringIgnoreCase(*), fieldsStrictCheck(*), arrayOrderStrictCheck(*) 
*ewPolicyConditionAtomic*ew(<PolicyVariable|Reference>{2,2},#opts?)negateResult(*), stringIgnoreCase(*), fieldsStrictCheck(*), arrayOrderStrictCheck(*) 
*containsPolicyConditionAtomic*contains(<PolicyVariable|Reference>{2,2},#opts?)negateResult(*), stringIgnoreCase(*), fieldsStrictCheck(*), arrayOrderStrictCheck(*) 
*isInPolicyConditionAtomic*isIn(<PolicyVariable|Reference>{2,2},#opts?)negateResult(*), stringIgnoreCase(*), fieldsStrictCheck(*), arrayOrderStrictCheck(*) 
*eqPolicyConditionAtomic*eq(<PolicyVariable|Reference>{2,2},#opts?)negateResult(*), stringIgnoreCase(*), fieldsStrictCheck(*), arrayOrderStrictCheck(*) 
*posPolicyConditionAtomic*pos(<PolicyVariable|Reference>{1,1},#opts?)negateResult(*) 
*negPolicyConditionAtomic*neg(<PolicyVariable|Reference>{1,1},#opts?)negateResult(*) 
*zeroPolicyConditionAtomic*zero(<PolicyVariable|Reference>{1,1},#opts?)negateResult(*) 
*pastPolicyConditionAtomic*past(<PolicyVariable|Reference>{1,1},#opts?)negateResult(*) 
*futurePolicyConditionAtomic*future(<PolicyVariable|Reference>{1,1},#opts?)negateResult(*) 
*regexpPolicyConditionAtomic*regexp(<PolicyVariable|Reference>{2,2},#opts?)negateResult(*) 
*hasKeyPolicyConditionAtomic*hasKey(<PolicyVariable|Reference>{2,2},#opts?)negateResult(*) 
*uniquePolicyConditionAtomic*unique(<PolicyVariable|Reference>{1,1},#opts?)negateResult(*) 
*schemaPolicyConditionAtomic*schema(<PolicyVariable|Reference>{2,2},#opts?)negateResult(*) 
*anyPolicyConditionComposite*any(<PolicyCondition|Reference>{1,},#opts?)negateResult(*), strictCheck(*) 
*allPolicyConditionComposite*all(<PolicyCondition|Reference>{1,},#opts?)negateResult(*), strictCheck(*) 
*notPolicyConditionComposite*not(<PolicyCondition|Reference>{1,1},#opts?)negateResult(*) 
*nOfPolicyConditionComposite*nOf(<PolicyCondition|Reference>{1,},#opts)minimumConditions(**), negateResult(*), strictCheck(*), optimize(*) 
#truePolicyConditionDefault#true(<>{0,0})  
#falsePolicyConditionDefault#false(<>{0,0})  
#nullPolicyConditionDefault#null(<>{0,0})  

(*) - Boolean condition
(**) - Mandatory option

PolicyConditionAtomic

PolicyConditionAtomic expressions can only contain PolicyVariable commands or references to PolicyVariables

GreaterThan

Template: *gt(<PolicyVariable|Reference>{2,2},#opts?)
Command starts with *gt
It contains exactly two parameters of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result
  • stringIgnoreCase - boolean, default value is null. Ignores casing when comparing strings

Minimal example:

*gt(#ref(pvd1), #int(0))

Full example with options:

*gt(#ref(pvd1), #ref(pvd2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult,stringIgnoreCase))

GreaterThanEqual

Template: *gte(<PolicyVariable|Reference>{2,2},#opts?)
Command starts with *gte
It contains exactly two parameters of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result
  • stringIgnoreCase - boolean, default value is null. Ignores casing when comparing strings

Minimal example:

*gte(#ref(pvd1), #int(0))

Full example with options:

*gte(#ref(pvd1), #ref(pvd2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult,stringIgnoreCase))

LessThan

Template: *lt(<PolicyVariable|Reference>{2,2},#opts?)
Command starts with *lt
It contains exactly two parameters of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result
  • stringIgnoreCase - boolean, default value is null. Ignores casing when comparing strings

Minimal example:

*lt(#ref(pvd1), #int(0))

Full example with options:

*lt(#ref(pvd1), #ref(pvd2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult,stringIgnoreCase))

LessThanEqual

Template: *lte(<PolicyVariable|Reference>{2,2},#opts?)
Command starts with *lte
It contains exactly two parameters of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result
  • stringIgnoreCase - boolean, default value is null. Ignores casing when comparing strings

Minimal example:

*lte(#ref(pvd1), #int(0))

Full example with options:

*lte(#ref(pvd1), #ref(pvd2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult,stringIgnoreCase))

IsNull

Template: *isNull(<PolicyVariable|Reference>{1,1},#opts?)
Command starts with *isNull
It contains exactly one parameter of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*isNull(#ref(pvd1))

Full example with options:

*isNull(#ref(pvd1),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

NotNull

Template: *notNull(<PolicyVariable|Reference>{1,1},#opts?)
Command starts with *notNull
It contains exactly one parameter of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*notNull(#ref(pvd1))

Full example with options:

*notNull(#ref(pvd1),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

IsEmpty

Template: *isEmpty(<PolicyVariable|Reference>{1,1},#opts?)
Command starts with *isEmpty
It contains exactly one parameter of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*isEmpty(#ref(pvd1))

Full example with options:

*isEmpty(#ref(pvd1),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

NotEmpty

Template: *notEmpty(<PolicyVariable|Reference>{1,1},#opts?)
Command starts with *notEmpty
It contains exactly one parameter of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*notEmpty(#ref(pvd1))

Full example with options:

*notEmpty(#ref(pvd1),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

IsBlank

Template: *isBlank(<PolicyVariable|Reference>{1,1},#opts?)
Command starts with *isBlank
It contains exactly one parameter of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*isBlank(#ref(pvd1))

Full example with options:

*isBlank(#ref(pvd1),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

NotBlank

Template: *notBlank(<PolicyVariable|Reference>{1,1},#opts?)
Command starts with *isNull
It contains exactly one parameter of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*notBlank(#ref(pvd1))

Full example with options:

*notBlank(#ref(pvd1),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

StartsWith

Template: *sw(<PolicyVariable|Reference>{2,2},#opts?)
Command starts with *sw
It contains exactly two parameters of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result
  • stringIgnoreCase - boolean, default value is null. Ignores casing when comparing strings
  • fieldsStrictCheck - boolean, default value is null. Strict checking for object keys
  • arrayOrderStrictCheck - boolean, default value is null. Strict checking for array order

Minimal example:

*sw(#ref(pvd1), #ref(pvd2))

Full example with options:

*sw(#ref(pvd1), #ref(pvd2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult,stringIgnoreCase,fieldsStrictCheck,arrayOrderStrictCheck))

EndsWith

Template: *ew(<PolicyVariable|Reference>{2,2},#opts?)
Command starts with *ew
It contains exactly two parameters of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result
  • stringIgnoreCase - boolean, default value is null. Ignores casing when comparing strings
  • fieldsStrictCheck - boolean, default value is null. Strict checking for object keys
  • arrayOrderStrictCheck - boolean, default value is null. Strict checking for array order

Minimal example:

*ew(#ref(pvd1), #ref(pvd2))

Full example with options:

*ew(#ref(pvd1), #ref(pvd2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult,stringIgnoreCase,fieldsStrictCheck,arrayOrderStrictCheck))

Contains

Template: *contains(<PolicyVariable|Reference>{2,2},#opts?)
Command starts with *contains
It contains exactly two parameters of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result
  • stringIgnoreCase - boolean, default value is null. Ignores casing when comparing strings
  • fieldsStrictCheck - boolean, default value is null. Strict checking for object keys
  • arrayOrderStrictCheck - boolean, default value is null. Strict checking for array order

Minimal example:

*contains(#ref(pvd1), #ref(pvd2))

Full example with options:

*contains(#ref(pvd1), #ref(pvd2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult,stringIgnoreCase,fieldsStrictCheck,arrayOrderStrictCheck))

IsIn

Template: *isIn(<PolicyVariable|Reference>{2,2},#opts?)
Command starts with *isIn
It contains exactly two parameters of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result
  • stringIgnoreCase - boolean, default value is null. Ignores casing when comparing strings
  • fieldsStrictCheck - boolean, default value is null. Strict checking for object keys
  • arrayOrderStrictCheck - boolean, default value is null. Strict checking for array order

Minimal example:

*isIn(#ref(pvd1), #ref(pvd2))

Full example with options:

*isIn(#ref(pvd1), #ref(pvd2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult,stringIgnoreCase,fieldsStrictCheck,arrayOrderStrictCheck))

Equals

Template: *eq(<PolicyVariable|Reference>{2,2},#opts?)
Command starts with *eq
It contains exactly two parameters of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result
  • stringIgnoreCase - boolean, default value is null. Ignores casing when comparing strings
  • fieldsStrictCheck - boolean, default value is null. Strict checking for object keys
  • arrayOrderStrictCheck - boolean, default value is null. Strict checking for array order

Minimal example:

*eq(#ref(pvd1), #ref(pvd2))

Full example with options:

*eq(#ref(pvd1), #ref(pvd2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult,stringIgnoreCase,fieldsStrictCheck,arrayOrderStrictCheck))

Positive

Template: *pos(<PolicyVariable|Reference>{1,1},#opts?)
Command starts with *pos
It contains exactly one parameter of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*pos(#ref(pvd1))

Full example with options:

*pos(#ref(pvd1),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

Negative

Template: *neg(<PolicyVariable|Reference>{1,1},#opts?)
Command starts with *neg
It contains exactly one parameter of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*neg(#ref(pvd1))

Full example with options:

*neg(#ref(pvd1),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

Zero

Template: *zero(<PolicyVariable|Reference>{1,1},#opts?)
Command starts with *pos
It contains exactly one parameter of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*zero(#ref(pvd1))

Full example with options:

*zero(#ref(pvd1),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

Past

Template: *past(<PolicyVariable|Reference>{1,1},#opts?)
Command starts with *past
It contains exactly one parameter of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*past(#ref(pvd1))

Full example with options:

*past(#ref(pvd1),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

Future

Template: *future(<PolicyVariable|Reference>{1,1},#opts?)
Command starts with *future
It contains exactly one parameter of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*future(#ref(pvd1))

Full example with options:

*future(#ref(pvd1),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

Regexp

Template: *regexp(<PolicyVariable|Reference>{2,2},#opts?)
Command starts with *regexp
It contains exactly two parameters of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*regexp(#ref(pvd1), #ref(pvd2))

Full example with options:

*regexp(#ref(pvd1), #ref(pvd2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

HasKey

Template: *hasKey(<PolicyVariable|Reference>{2,2},#opts?)
Command starts with *hasKey
It contains exactly two parameters of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*hasKey(#ref(pvd1), #ref(pvd2))

Full example with options:

*hasKey(#ref(pvd1), #ref(pvd2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

Unique

Template: *unique(<PolicyVariable|Reference>{1,1},#opts?)
Command starts with *unique
It contains exactly one parameter of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*unique(#ref(pvd1))

Full example with options:

*unique(#ref(pvd1),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

Schema

Template: *schema(<PolicyVariable|Reference>{2,2},#opts?)
Command starts with *schema
It contains exactly two parameters of type PolicyVariable or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*schema(#ref(pvd1), #ref(pvd2))

Full example with options:

*schema(#ref(pvd1), #ref(pvd2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

PolicyConditionComposite

PolicyConditionComposite expressions can only contain PolicyCondition commands or references to PolicyConditions

Any

Template: *any(<PolicyCondition|Reference>{1,},#opts?)
Command starts with *any
It contains at least one parameter of type PolicyCondition or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result
  • strictCheck - boolean, default value is null. Checks all conditions

Minimal example:

*any(#ref(pcr1,1.2.3),#ref(pcr2))

Full example with options:

*any(#ref(pcr1,1.2.3),#ref(pcr2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult,strictCheck))

All

Template: *all(<PolicyCondition|Reference>{1,},#opts?)
Command starts with *all
It contains at least one parameter of type PolicyCondition or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result
  • strictCheck - boolean, default value is null. Checks all conditions

Minimal example:

*all(#ref(pcr1,1.2.3),#ref(pcr2))

Full example with options:

*all(#ref(pcr1,1.2.3),#ref(pcr2),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult,strictCheck))

Not

Template: *not(<PolicyCondition|Reference>{1,1},#opts?)
Command starts with *all
It contains exactly one parameter of type PolicyCondition or Reference
Supported options:

  • negateResult - boolean, default value is null. Negates condition result

Minimal example:

*not(#ref(pcr1,1.2.3))

Full example with options:

*not(#ref(pcr1,1.2.3),#opts(id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult))

NOf

Template: *nOf(<PolicyCondition|Reference>{1,},#opts)
Command starts with *nOf
It contains at least one parameter of type PolicyCondition or Reference
Supported options:

  • minimumConditions - Mandatory Int, no default value. Defines minimum number of conditions that should resolve to true
  • negateResult - boolean, default value is null. Negates condition result
  • strictCheck - boolean, default value is null. Checks all conditions
  • optimize - boolean, default value is null. Runs check in optimized manner

Minimal example:

*nOf(#ref(pcr1,1.2.3),#ref(pcr2),#opts(minimumConditions=1))

Full example with options:

*nOf(#ref(pcr1,1.2.3),#ref(pcr2),#opts(minimumConditions=1,id=cond,ver=1.2.3,desc="Some desc",labels=foo|bar,negateResult,strictCheck,optimize))

PolicyConditionDefault

PolicyConditionDefault expressions are without parameters or options

True

Template: #true(<>{0,0})
Command starts with #true
It cannot contain any parameter
Supported options:

  • none

Example:

#true()

False

Template: #false(<>{0,0})
Command starts with #false
It cannot contain any parameter
Supported options:

  • none

Example:

#false()

Null

Template: #null(<>{0,0})
Command starts with #null
It cannot contain any parameter
Supported options:

  • none

Example:

#null()