Skip to content

List Operators

List operators check whether a value exists in a set or whether a collection contains a value.

Check if a value is one of a set of allowed values:

__role__ of **User** is in ["admin", "moderator", "editor"]

Interactive Example

Policy Rule
Test Data (JSON)

Works with numbers too:

Interactive Example

Policy Rule
Test Data (JSON)

Check if a value is not in a set (blocklist):

__status__ of **User** is not in ["banned", "suspended", "deleted"]

Interactive Example

Policy Rule
Test Data (JSON)

Check if a string or collection contains a value:

__tags__ of **Article** contains "featured"

Interactive Example

Policy Rule
Test Data (JSON)

Check if a list contains every element from another list:

__permissions__ of **User** contains all of ["read", "write"]

Interactive Example

Policy Rule
Test Data (JSON)

Returns false if even one element is missing:

Interactive Example

Policy Rule
Test Data (JSON)

Check if a list contains at least one element from another list:

__roles__ of **User** contains any of ["admin", "superadmin"]

Interactive Example

Policy Rule
Test Data (JSON)
OperatorUse case
is in [...]Value is one of a set (allowlist)
is not in [...]Value is none of a set (blocklist)
containsString/collection contains a value
contains all of [...]List contains every element from another list
contains any of [...]List contains at least one element from another list