rfc822NameAtLeastOneMemberOf Function Description

Description

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

rfc822NameAtLeastOneMemberOf 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:rfc822Name-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 rfc822Name
Return Value boolean
Expressed As pre-fix
Representation ALFA short name
Allowed In Target false
ALFA Shorthand None
Commutative true

Example

/**
 * Permit if at least one of the user's emails is in the list of allowed emails or
 * is equal to [email protected].
 * Both bags can be multi-valued.
 */
rule rfc822NameAtLeastOneMemberOfExample{
    permit
    condition rfc822NameAtLeastOneMemberOf(userEmails, allowedEmails) ||
              rfc822NameAtLeastOneMemberOf(userEmails, rfc822NameBag("mail:[email protected]":rfc822Name))
}

In this example, the rule will evaluate to Permit if there is at least one value in the userEmails bag equal to at least one value in the allowedEmails bag or if there is at least one value in the userEmails bag equal to "[email protected]".