You are here

protected function CasAttributesSubscriber::checkRoleMatchRegexAny in CAS Attributes 8

Same name and namespace in other branches
  1. 2.x src/Subscriber/CasAttributesSubscriber.php \Drupal\cas_attributes\Subscriber\CasAttributesSubscriber::checkRoleMatchRegexAny()

Check if attribuets match using the 'regex_any' method.

Each item in attribute array is checked with a regex.

Parameters

array $attributeValue: The actual attribute value.

string $regex: The regular expression pattern.

Return value

bool TRUE if there's a match, FALSE otherwise.

1 call to CasAttributesSubscriber::checkRoleMatchRegexAny()
CasAttributesSubscriber::doRoleMapCheck in src/Subscriber/CasAttributesSubscriber.php
Determine which roles should be added/removed based on attributes.

File

src/Subscriber/CasAttributesSubscriber.php, line 338

Class

CasAttributesSubscriber
Provides a CasAttributesSubscriber.

Namespace

Drupal\cas_attributes\Subscriber

Code

protected function checkRoleMatchRegexAny(array $attributeValue, $regex) {
  foreach ($attributeValue as $value) {
    if (@preg_match($regex, $value)) {
      return TRUE;
    }
  }
  return FALSE;
}