public function ServicesClientUserRoleCondition::match in Services Client 7.2
Check if entity matches condition.
Parameters
stdClass $entity: Drupal entity that should be matched.
Return value
bool TRUE if matches condition.
Overrides ServicesClientConditionInterface::match
File
- include/
condition.inc, line 398
Class
Code
public function match($entity) {
$roles_intersect = array_intersect($this->config['roles'], $entity->roles);
if ($this->config['intersect']) {
$matched = $this->config['roles'] == $roles_intersect;
}
else {
$matched = !empty($roles_intersect);
}
return $this->config['reverse'] ? !$matched : $matched;
}