numeric
Less than 1 minute
Syntax
(*numeric)${...}
(*numeric)<string>
Examples
(*numeric)${CALLBACK.random_number}
- converts a value returned by therandom_number
function to either float or integer.(*numeric)3.4
- converts a string "3.4" to float number 3.4.(*numeric)5
- converts a string "5" to integer 5
Definition
Treat provided value as a numeric value. The value is checked if it is either an integer or float and cast accordingly. If the provided value is not numeric, it converts to the 0
(zero) integer value.
The numeric
typecast is good when you do not know up-front if you'll get a float or an integer value. AAM checks if the value is a float with the PHP core function is_float, and if it is not, the integer value is assumed.
The following policy allows browsing few categories if the callback function random_number
returns whitelisted numeric value.
{
"Statement": [
{
"Effect": "deny",
"Resource": "${POLICY_PARAM.ProtectedCategories}",
"Action": [
"List",
"Read"
]
},
{
"Effect": "allow",
"Resource": "${POLICY_PARAM.ProtectedCategories}",
"Action": [
"List",
"Read"
],
"Condition": {
"In": {
"(*numeric)${CALLBACK.random_number}": [
5,
3.4,
15,
2.9
]
}
}
}
],
"Param": {
"Key": "ProtectedCategories",
"Value": [
"Term:category:category-a",
"Term:category:category-b",
"Term:category:category-c"
]
}
}
Virtual Assistant