function services_requirements in Services 7.3
Same name and namespace in other branches
- 6.3 services.install \services_requirements()
Implements hook_requirements().
File
- ./
services.install, line 117 - Install, uninstall and update the Services module.
Code
function services_requirements($phase) {
$requirements = array();
$t = get_t();
// Warn users of the possible threat.
if ($phase == 'runtime') {
//Pull endpoints that do not have services authentication enabled
module_load_include('module', 'services');
$endpoints = services_endpoint_load_all();
$items = array();
// Build our items array
foreach ($endpoints as $endpoint) {
if (empty($endpoint->disabled) && empty($endpoint->authentication)) {
$items[] = l($endpoint->name, 'admin/structure/services/list/' . $endpoint->name . '/edit');
}
}
// theme the endpoints list
$endpoints = '';
if (!empty($items)) {
$endpoints = theme('item_list', array(
'items' => $items,
));
}
// Only display the list if we have at least one endpoint without services authentication.
if (count($items)) {
$requirements['services'] = array(
'description' => $t('Services authentication mechanism has not been enabled for the following endpoints. Requests to these endpoints will always be anonymous.'),
'severity' => REQUIREMENT_WARNING,
'value' => $endpoints,
'title' => 'Services Authentication Mechanism',
);
}
else {
$requirements['services'] = array(
'severity' => REQUIREMENT_OK,
'value' => 'Enabled for all Endpoints',
'title' => 'Services Authentication Mechanism',
);
}
$services_security_update = variable_get('services_security_update_1', FALSE);
if (!$services_security_update) {
$url = url('admin/config/services/services-security');
$requirements['services'] = array(
'description' => $t('Services has issued a security update with the most recent module release. Administrative steps are required to secure your Drupal installation <a href="!url">here</a>.', array(
'!url' => $url,
)),
'severity' => REQUIREMENT_ERROR,
'value' => 'Steps needed',
'title' => 'Services Authentication Mechanism',
);
}
}
return $requirements;
}