timeIsIn Function Description

Description

Returns true if the value of the first parameter is in the bag of values of the second parameter. Attributes of type time are compared using the timeEqual function.

timeIsIn belongs to the ALFA function reference's Bag functions category. It maps to the XACML function identifier urn:oasis:names:tc:xacml:1.0:function:time-is-in, takes 2 arguments and returns a value of type boolean.

Property Value
Category Bag functions
# Arguments 2
Arguments
  • atomic (single) value of type time
  • bag (collection) of values of type time
Return Value boolean
Expressed As pre-fix
Representation ALFA short name
Allowed In Target true
ALFA Shorthand None
Commutative false

Example

/**
* Allow a user to eat if it's breakfast, lunch, or dinner. Note the use of special
* attribute currentTime which the PDP resolves itself to the current time. Note the use
* of timeBag() to construct a collection of times.
*/
rule timeIsInExample{
    target clause Attributes.actionId=="eat"
    permit
    condition timeIsIn(timeOneAndOnly(Attributes.currentTime),timeBag("09:00:00":time,"12:00:00":time,"19:00:00":time))
}

Permit if the value passed as the first parameter is in the bag of values passed as the second parameter