public function allowMultiple($permissions, $needsAll = false)
{
//If not an array, make a one item array
if (!is_array($permissions)) {
$permissions = array($permissions);
}
//User has to possess all of the permissions specified
if ($needsAll) {
$hasPermissions = 0;
$numPermissions = count($permissions);
foreach ($permissions as $perm) {
if ($this->allow($perm)) {
$hasPermissions++;
}
}
return $numPermissions == $hasPermissions;
}
//User has to possess one of the permissions specified
foreach ($permissions as $perm) {
if ($this->allow($perm)) {
return true;
}
}
return false;
}