You are here

protected function CasAttributesSubscriber::checkRoleMatchContainsAny in CAS Attributes 8

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

Check if attributes match using the 'contains_any' method.

Works by checking if any item in attribute value contains the value to match as a substring.

Parameters

array $attributeValue: The actual attribute value.

string $valueToMatch: The attribute value to compare against.

Return value

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

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

File

src/Subscriber/CasAttributesSubscriber.php, line 315

Class

CasAttributesSubscriber
Provides a CasAttributesSubscriber.

Namespace

Drupal\cas_attributes\Subscriber

Code

protected function checkRoleMatchContainsAny(array $attributeValue, $valueToMatch) {
  foreach ($attributeValue as $value) {
    if (strpos($value, $valueToMatch) !== FALSE) {
      return TRUE;
    }
  }
  return FALSE;
}