--- modules/user.module	2005-11-30 13:11:27.046875000 +0100
+++ modules/user.module.new	2005-12-02 00:40:03.281250000 +0100
@@ -424,7 +424,7 @@
  * Implementation of hook_perm().
  */
 function user_perm() {
-  return array('administer access control', 'administer users', 'access user profiles');
+  return array('administer access control', 'administer users', 'access user profiles', 'change own username');
 }
 
 /**
@@ -1157,7 +1157,9 @@
 function user_edit_form($uid, $edit) {
   // Account information:
   $form['account'] = array('#type' => 'fieldset', '#title' => t('Account information'), '#weight' => 0);
-  $form['account']['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $edit['name'], '#maxlength' => 55, '#description' => t('Your full name or your preferred username: only letters, numbers and spaces are allowed.'), '#required' => TRUE);
+  if (user_access('change own username') || user_access('administer users')) {
+  	$form['account']['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $edit['name'], '#maxlength' => 55, '#description' => t('Your full name or your preferred username: only letters, numbers and spaces are allowed.'), '#required' => TRUE);
+  }
   $form['account']['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => $edit['mail'], '#maxlength' => 55, '#description' => t('Insert a valid e-mail address.  All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), '#required' => TRUE);
   $form['account']['pass'] = array('#type' => 'item', '#title' => t('Password'), '#value' => '<input type="password" class="form-password" name="edit[pass1]" size="12" maxlength="24" /> <input type="password" class="form-password" name="edit[pass2]" size="12" maxlength="24" />', '#required' => true);
   if (user_access('administer users')) {
