Check to make sure that the array of permissions are valid.
$permissions: Permissions to check.
$reset: Reset cached available permissions.
TRUE or FALSE depending on whether the permissions are valid.
protected function checkPermissions(array $permissions, $reset = FALSE) {
$available =& drupal_static(__FUNCTION__);
if (!isset($available) || $reset) {
$available = array_keys(module_invoke_all('permission'));
}
$valid = TRUE;
foreach ($permissions as $permission) {
if (!in_array($permission, $available)) {
$this
->fail(t('Invalid permission %permission.', array(
'%permission' => $permission,
)), t('Role'));
$valid = FALSE;
}
}
return $valid;
}