dateAtLeastOneMemberOf Function Description

Description

This function takes in two parameters of type bag of date and returns true if there is at least one value in the first bag equal to at least one value in the second bag.

dateAtLeastOneMemberOf belongs to the ALFA function reference's Set functions category. It maps to the XACML function identifier urn:oasis:names:tc:xacml:1.0:function:date-at-least-one-member-of, takes 2 arguments and returns a value of type boolean.

Property Value
Category Set functions
# Arguments 2
Arguments
  • 2 bags of values of type date
Return Value boolean
Expressed As pre-fix
Representation ALFA short name
Allowed In Target false
ALFA Shorthand None
Commutative true

Example

/**
 * Permit if there is at least one requested date in the list of available dates or
 * there is at least one requested date equal to either 01/01/2019 or 01/02/2019.
 * (mm/dd/yyyy)
 */
rule dateAtLeastOneMemberOfExample{
    permit
    condition dateAtLeastOneMemberOf(requestedDates, availableDates) ||
              dateAtLeastOneMemberOf(requestedDates, dateBag("2019-01-01":date,"2019-01-02":date))
}

In this example, the rule will return Permit if there is at least one value in the requested dates equal to at least one value in the available dates. In addition, access may be permitted if there is one value in the requested dates equal to either 2019-01-01 or 2019-01-02. The second part of the condition shows how to build a bag of date attributes using the dateBag() function and the :date type transformer.