/**
* Checks that this action can be performed by an identity.
*
* The identity is an integer where +ve represents a user group,
* and -ve represents a user.
*
* @param mixed $identities An integer or array of integers representing the identities to check.
*
* @return mixed True if allowed, false for an explicit deny, null for an implicit deny.
*
* @since 1.7.0
*/
public function allow($identities)
{
// Implicit deny by default.
$result = null;
// Check that the inputs are valid.
if (!empty($identities)) {
if (!\is_array($identities)) {
$identities = array($identities);
}
foreach ($identities as $identity) {
// Technically the identity just needs to be unique.
$identity = (int) $identity;
// Check if the identity is known.
if (isset($this->data[$identity])) {
$result = (bool) $this->data[$identity];
// An explicit deny wins.
if ($result === false) {
break;
}
}
}
}
return $result;
}