- Patch #549432 by Gábor Hojtsy: moving 'IP blocking' to 'People and permissions'.
parent
5d9b703485
commit
bee1240231
|
@ -132,7 +132,7 @@ function statistics_top_visitors() {
|
|||
$rows = array();
|
||||
foreach ($result as $account) {
|
||||
$qs = drupal_get_destination();
|
||||
$ban_link = $account->iid ? l(t('unblock IP address'), "admin/settings/ip-blocking/delete/$account->iid", array('query' => $qs)) : l(t('block IP address'), "admin/settings/ip-blocking/$account->hostname", array('query' => $qs));
|
||||
$ban_link = $account->iid ? l(t('unblock IP address'), "admin/config/people/ip-blocking/delete/$account->iid", array('query' => $qs)) : l(t('block IP address'), "admin/config/people/ip-blocking/$account->hostname", array('query' => $qs));
|
||||
$rows[] = array($account->hits, ($account->uid ? theme('username', $account) : $account->hostname), format_interval(round($account->total / 1000)), (user_access('block IP addresses') && !$account->uid) ? $ban_link : '');
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class StatisticsBlockVisitorsTestCase extends DrupalWebTestCase {
|
|||
$this->assertText(t('IP address blocking'), t('IP blocking page displayed.'));
|
||||
$edit = array();
|
||||
$edit['ip'] = $test_ip_address;
|
||||
$this->drupalPost('admin/settings/ip-blocking', $edit, t('Save'));
|
||||
$this->drupalPost('admin/config/people/ip-blocking', $edit, t('Save'));
|
||||
$ip = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $edit['ip']))->fetchField();
|
||||
$this->assertNotEqual($ip, FALSE, t('IP address found in database'));
|
||||
$this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $edit['ip'])), t('IP address was blocked.'));
|
||||
|
@ -66,7 +66,7 @@ class StatisticsBlockVisitorsTestCase extends DrupalWebTestCase {
|
|||
$this->clickLink('unblock IP address');
|
||||
$this->assertRaw(t('Are you sure you want to delete %ip?', array('%ip' => $test_ip_address)), t('IP address deletion confirmation found.'));
|
||||
$edit = array();
|
||||
$this->drupalPost('admin/settings/ip-blocking/delete/1', NULL, t('Delete'));
|
||||
$this->drupalPost('admin/config/people/ip-blocking/delete/1', NULL, t('Delete'));
|
||||
$this->assertRaw(t('The IP address %ip was deleted.', array('%ip' => $test_ip_address)), t('IP address deleted.'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1162,7 +1162,7 @@ function system_ip_blocking() {
|
|||
foreach ($result as $ip) {
|
||||
$rows[] = array(
|
||||
$ip->ip,
|
||||
l(t('delete'), "admin/settings/ip-blocking/delete/$ip->iid"),
|
||||
l(t('delete'), "admin/config/people/ip-blocking/delete/$ip->iid"),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1221,7 +1221,7 @@ function system_ip_blocking_form_submit($form, &$form_state) {
|
|||
->fields(array('ip' => $ip))
|
||||
->execute();
|
||||
drupal_set_message(t('The IP address %ip has been blocked.', array('%ip' => $ip)));
|
||||
$form_state['redirect'] = 'admin/settings/ip-blocking';
|
||||
$form_state['redirect'] = 'admin/config/people/ip-blocking';
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1235,7 +1235,7 @@ function system_ip_blocking_delete(&$form_state, $iid) {
|
|||
'#type' => 'value',
|
||||
'#value' => $iid,
|
||||
);
|
||||
return confirm_form($form, t('Are you sure you want to delete %ip?', array('%ip' => $iid['ip'])), 'admin/settings/ip-blocking', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
|
||||
return confirm_form($form, t('Are you sure you want to delete %ip?', array('%ip' => $iid['ip'])), 'admin/config/people/ip-blocking', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1248,7 +1248,7 @@ function system_ip_blocking_delete_submit($form, &$form_state) {
|
|||
->execute();
|
||||
watchdog('user', 'Deleted %ip', array('%ip' => $blocked_ip['ip']));
|
||||
drupal_set_message(t('The IP address %ip was deleted.', array('%ip' => $blocked_ip['ip'])));
|
||||
$form_state['redirect'] = 'admin/settings/ip-blocking';
|
||||
$form_state['redirect'] = 'admin/config/people/ip-blocking';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -138,7 +138,7 @@ function system_help($path, $arg) {
|
|||
return $output;
|
||||
case 'admin/settings/actions/configure':
|
||||
return t('An advanced action offers additional configuration options which may be filled out below. Changing the <em>Description</em> field is recommended, in order to better identify the precise action taking place. This description will be displayed in modules such as the trigger module when assigning actions to system events, so it is best if it is as descriptive as possible (for example, "Send e-mail to Moderation Team" rather than simply "Send e-mail").');
|
||||
case 'admin/settings/ip-blocking':
|
||||
case 'admin/config/people/ip-blocking':
|
||||
return '<p>' . t('IP addresses listed here are blocked from your site before any modules are loaded. You may add IP addresses to the list, or delete existing entries.') . '</p>';
|
||||
case 'admin/reports/status':
|
||||
return '<p>' . t("Here you can find a short overview of your site's parameters as well as any problems detected with your installation. It may be useful to copy and paste this information into support requests filed on drupal.org's support forums and project issue queues.") . '</p>';
|
||||
|
@ -660,20 +660,20 @@ function system_menu() {
|
|||
);
|
||||
|
||||
// IP address blocking.
|
||||
$items['admin/settings/ip-blocking'] = array(
|
||||
$items['admin/config/people/ip-blocking'] = array(
|
||||
'title' => 'IP address blocking',
|
||||
'description' => 'Manage blocked IP addresses.',
|
||||
'page callback' => 'system_ip_blocking',
|
||||
'access arguments' => array('block IP addresses'),
|
||||
);
|
||||
$items['admin/settings/ip-blocking/%'] = array(
|
||||
$items['admin/config/people/ip-blocking/%'] = array(
|
||||
'title' => 'IP address blocking',
|
||||
'description' => 'Manage blocked IP addresses.',
|
||||
'page callback' => 'system_ip_blocking',
|
||||
'access arguments' => array('block IP addresses'),
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
$items['admin/settings/ip-blocking/delete/%blocked_ip'] = array(
|
||||
$items['admin/config/people/ip-blocking/delete/%blocked_ip'] = array(
|
||||
'title' => 'Delete IP address',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('system_ip_blocking_delete', 4),
|
||||
|
|
|
@ -312,12 +312,12 @@ class IPAddressBlockingTestCase extends DrupalWebTestCase {
|
|||
* Test a variety of user input to confirm correct validation and saving of data.
|
||||
*/
|
||||
function testIPAddressValidation() {
|
||||
$this->drupalGet('admin/settings/ip-blocking');
|
||||
$this->drupalGet('admin/config/people/ip-blocking');
|
||||
|
||||
// Block a valid IP address.
|
||||
$edit = array();
|
||||
$edit['ip'] = '192.168.1.1';
|
||||
$this->drupalPost('admin/settings/ip-blocking', $edit, t('Save'));
|
||||
$this->drupalPost('admin/config/people/ip-blocking', $edit, t('Save'));
|
||||
$ip = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $edit['ip']))->fetchField();
|
||||
$this->assertNotNull($ip, t('IP address found in database'));
|
||||
$this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $edit['ip'])), t('IP address was blocked.'));
|
||||
|
@ -325,32 +325,32 @@ class IPAddressBlockingTestCase extends DrupalWebTestCase {
|
|||
// Try to block an IP address that's already blocked.
|
||||
$edit = array();
|
||||
$edit['ip'] = '192.168.1.1';
|
||||
$this->drupalPost('admin/settings/ip-blocking', $edit, t('Save'));
|
||||
$this->drupalPost('admin/config/people/ip-blocking', $edit, t('Save'));
|
||||
$this->assertText(t('This IP address is already blocked.'));
|
||||
|
||||
// Try to block a reserved IP address.
|
||||
$edit = array();
|
||||
$edit['ip'] = '255.255.255.255';
|
||||
$this->drupalPost('admin/settings/ip-blocking', $edit, t('Save'));
|
||||
$this->drupalPost('admin/config/people/ip-blocking', $edit, t('Save'));
|
||||
$this->assertText(t('Please enter a valid IP address.'));
|
||||
|
||||
// Try to block a reserved IP address.
|
||||
$edit = array();
|
||||
$edit['ip'] = 'test.example.com';
|
||||
$this->drupalPost('admin/settings/ip-blocking', $edit, t('Save'));
|
||||
$this->drupalPost('admin/config/people/ip-blocking', $edit, t('Save'));
|
||||
$this->assertText(t('Please enter a valid IP address.'));
|
||||
|
||||
// Submit an empty form.
|
||||
$edit = array();
|
||||
$edit['ip'] = '';
|
||||
$this->drupalPost('admin/settings/ip-blocking', $edit, t('Save'));
|
||||
$this->drupalPost('admin/config/people/ip-blocking', $edit, t('Save'));
|
||||
$this->assertText(t('Please enter a valid IP address.'));
|
||||
|
||||
// Submit your own IP address. This fails, although it works when testing manually.
|
||||
// TODO: on some systems this test fails due to a bug or inconsistency in cURL.
|
||||
// $edit = array();
|
||||
// $edit['ip'] = ip_address();
|
||||
// $this->drupalPost('admin/settings/ip-blocking', $edit, t('Save'));
|
||||
// $this->drupalPost('admin/config/people/ip-blocking', $edit, t('Save'));
|
||||
// $this->assertText(t('You may not block your own IP address.'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue