diff --git a/modules/user/user.module b/modules/user/user.module index 8917192..91e97ab 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -1076,8 +1076,8 @@ function user_menu() { 'title' => 'Delete', 'page callback' => 'drupal_get_form', 'page arguments' => array('user_confirm_delete', 1), - 'access callback' => 'user_access', - 'access arguments' => array('administer users'), + 'access callback' => 'user_delete_access', + 'access arguments' => array(1), 'type' => MENU_CALLBACK, 'file' => 'user.pages.inc', ); @@ -2537,3 +2537,13 @@ function user_login_destination() { $destination = drupal_get_destination(); return $destination == 'destination=user%2Flogin' ? 'destination=user' : $destination; } + +/** + * Menu access callback; limit access to account deletion pages. + * + * Limit access to administrative users, and prevent the anonymous user account + * from being cancelled. + */ +function user_delete_access($account) { + return user_access('administer users') && $account->uid > 0; +}