public function check($requester, $params, array $options = array())
{
if (empty($this->_roles)) {
throw new ConfigException('No roles defined for adapter configuration.');
}
$roleDefaults = array('message' => '', 'redirect' => '', 'allow' => true, 'requesters' => '*', 'match' => '*::*');
$message = $options['message'];
$redirect = $options['redirect'];
$accessible = false;
foreach ($this->_roles as $role) {
$role += $roleDefaults;
if (is_callable($role['allow'])) {
$role['allow'] = (array) $role['allow'];
}
// Check to see if this role applies to this request
if (!static::parseMatch($role['match'], $params)) {
continue;
}
$accessible = static::_isAccessible($role, $params, $options);
if (!$accessible) {
$message = !empty($role['message']) ? $role['message'] : $message;
$redirect = !empty($role['redirect']) ? $role['redirect'] : $redirect;
}
}
return !$accessible ? compact('message', 'redirect') : array();
}