And
This section describes features that are coming in 4.0
The and
condition lets you perform a logical AND operation across multiple sub-conditions.
Configuration
{
"type": "and",
"config": {
"conditions": [
... subconditions
]
}
}
Sample #1
This policy document allows a principal to read content from the /products
so long as it is of type my:article
.
{
"title": "My Sample Policy",
"statements": [{
"action": "grant",
"roles": ["consumer"],
"conditions": [{
"type": "and",
"config": {
"conditions": [{
"type": "path",
"config": {
"path": "^/products/.*"
}
}, {
"type": "type-qname",
"config": {
"qname": "my:article"
}
}]
}
}]
}]
}
Sample #2
This policy document allows a principal to read content from the /products
so long as it is of type my:article
or my:blogpost
.
{
"title": "My Sample Policy",
"statements": [{
"action": "grant",
"roles": ["consumer"],
"conditions": [{
"type": "and",
"config": {
"conditions": [{
"type": "path",
"config": {
"path": "^/products/.*"
}
}, {
"type": "or",
"config": {
"conditions": [{
"type": "type-qname",
"config": {
"qname": "my:article"
}
}, {
"type": "type-qname",
"config": {
"qname": "my:blogpost"
}
}]
}
}]
}
}]
}]
}