? taxo_nodeapi.patch
? taxonomy_load_on_nodeapi.diff.txt
? sites/me.dpr
Index: database/updates.inc
===================================================================
RCS file: /cvs/drupal/drupal/database/updates.inc,v
retrieving revision 1.182
diff -F^f -u -r1.182 updates.inc
--- database/updates.inc	10 Jan 2006 19:33:57 -0000	1.182
+++ database/updates.inc	12 Jan 2006 05:17:35 -0000
@@ -1429,3 +1429,9 @@ function system_update_168() {
 
   return $ret;
 }
+
+function system_update_169() {
+  $ret = array();
+  $ret[] = update_sql("DELETE FROM {users_roles} WHERE rid = ". drupal_authenticated_id());
+  return $ret;
+}
Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.80
diff -F^f -u -r1.80 bootstrap.inc
--- includes/bootstrap.inc	5 Jan 2006 10:51:47 -0000	1.80
+++ includes/bootstrap.inc	12 Jan 2006 05:17:36 -0000
@@ -808,6 +808,10 @@ function drupal_is_denied($type, $mask) 
   return $deny && !$allow;
 }
 
+function drupal_authenticated_id() {
+  return db_result(db_query("SELECT rid FROM {role} WHERE name = 'authenticated user'"));
+}
+
 /**
  * A string describing a phase of Drupal to load. Each phase adds to the
  * previous one, so invoking a later phase automatically runs the earlier
Index: includes/session.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/session.inc,v
retrieving revision 1.22
diff -F^f -u -r1.22 session.inc
--- includes/session.inc	31 Dec 2005 11:50:47 -0000	1.22
+++ includes/session.inc	12 Jan 2006 05:17:36 -0000
@@ -30,8 +30,13 @@ function sess_read($key) {
   $user = drupal_unpack($user);
   $user->roles = array();
 
+  if ($user->uid) {
+    $user->roles[drupal_authenticated_id()] = 'authenticated user';
+  }
+  else {
+    $user->roles[0] = 'anonymous user';
+  }
   $result = db_query("SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d", $user->uid);
-
   while ($role = db_fetch_object($result)) {
     $user->roles[$role->rid] = $role->name;
   }
Index: modules/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user.module,v
retrieving revision 1.553
diff -F^f -u -r1.553 user.module
--- modules/user.module	10 Jan 2006 20:11:46 -0000	1.553
+++ modules/user.module	12 Jan 2006 05:17:41 -0000
@@ -67,11 +67,13 @@ function user_load($array = array()) {
     $user = db_fetch_object($result);
     $user = drupal_unpack($user);
 
-    $user->roles = array();
+    $user->roles[drupal_authenticated_id()] = 'authenticated user';
     $result = db_query('SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d', $user->uid);
     while ($role = db_fetch_object($result)) {
       $user->roles[$role->rid] = $role->name;
     }
+    
+
     user_module_invoke('load', $array, $user);
   }
   else {
@@ -133,7 +135,9 @@ function user_save($account, $array = ar
       db_query('DELETE FROM {users_roles} WHERE uid = %d', $account->uid);
 
       foreach (array_keys($array['roles']) as $rid) {
-        db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $account->uid, $rid);
+        if ($rid != 0 && $rid != drupal_authenticated_id()) {
+          db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $account->uid, $rid);
+        }
       }
     }
 
@@ -170,7 +174,7 @@ function user_save($account, $array = ar
 
     // Reload user roles (delete just to be safe).
     db_query('DELETE FROM {users_roles} WHERE uid = %d', $array['uid']);
-    foreach ($array['roles'] as $rid) {
+    foreach ((array)$array['roles'] as $rid) {
       db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $array['uid'], $rid);
     }
 
@@ -339,7 +343,7 @@ function user_access($string, $account =
   // To reduce the number of SQL queries, we cache the user's permissions
   // in a static variable.
   if (!isset($perm[$account->uid])) {
-    $result = db_query('SELECT DISTINCT(p.perm) FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d', $account->uid);
+    $result = db_query("SELECT DISTINCT(p.perm) FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid WHERE r.rid IN (%s)", implode(',', array_keys($account->roles)));
 
     $perm[$account->uid] = '';
     while ($row = db_fetch_object($result)) {
@@ -930,7 +934,7 @@ function user_authenticate($name, $pass)
           if (variable_get('user_register', 1) == 1) {
             $account = user_load(array('name' => "$name@$server"));
             if (!$account->uid) { // Register this new user.
-              $user = user_save('', array('name' => "$name@$server", 'pass' => user_password(), 'init' => "$name@$server", 'status' => 1, "authname_$module" => "$name@$server", 'roles' => array(_user_authenticated_id())));
+              $user = user_save('', array('name' => "$name@$server", 'pass' => user_password(), 'init' => "$name@$server", 'status' => 1, "authname_$module" => "$name@$server"));
               watchdog('user', t('New external user: %user using module %module.', array('%user' => theme('placeholder', $name .'@'. $server), '%module' => theme('placeholder', $module))), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit'));
               break;
             }
@@ -942,10 +946,6 @@ function user_authenticate($name, $pass)
   return $user;
 }
 
-function _user_authenticated_id() {
-  return db_result(db_query("SELECT rid FROM {role} WHERE name = 'authenticated user'"));
-}
-
 /**
  * Menu callback; logs the current user out, and redirects to the home page.
  */
@@ -1124,7 +1124,7 @@ function user_register_submit($form_id, 
     drupal_goto('user/register');
   }
 
-  $account = user_save('', array_merge($form_values, array('pass' => $pass, 'init' => $mail, 'roles' => array('authenticated user' => _user_authenticated_id()), 'status' => ($admin || variable_get('user_register', 1) == 1))));
+  $account = user_save('', array_merge($form_values, array('pass' => $pass, 'init' => $mail, 'status' => ($admin || variable_get('user_register', 1) == 1))));
   watchdog('user', t('New user: %name %email.', array('%name' => theme('placeholder', $name), '%email' => theme('placeholder', '<'. $mail .'>'))), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $account->uid .'/edit'));
 
   $variables = array('%username' => $name, '%site' => variable_get('site_name', 'drupal'), '%password' => $pass, '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $mail, '%date' => format_date(time()), '%login_uri' => url('user', NULL, NULL, TRUE), '%edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE), '%login_url' => user_pass_reset_url($account));
@@ -1182,7 +1182,11 @@ function user_edit_form($uid, $edit) {
     $form['account']['status'] = array('#type' => 'radios', '#title' => t('Status'), '#default_value' => $edit['status'], '#options' => array(t('Blocked'), t('Active')));
   }
   if (user_access('administer access control')) {
-    $form['account']['roles'] = array('#type' => 'checkboxes', '#title' => t('Roles'), '#default_value' => array_keys((array)$edit['roles']), '#options' => user_roles(1), '#description' => t('Select at least one role.  The user receives the combined permissions of all of the selected roles.'), '#required' => TRUE);
+    $roles = user_roles(1);
+    unset($roles[drupal_authenticated_id()]);
+    if ($roles) {
+      $form['account']['roles'] = array('#type' => 'checkboxes', '#title' => t('Roles'), '#default_value' => array_keys((array)$edit['roles']), '#options' => $roles, '#description' => t('The user receives the combined permissions of the %au role, and all roles selected here.', array('%au' => theme('placeholder', t('authenticated user')))), '#required' => TRUE);
+    }
   }
 
   // Picture/avatar:
@@ -1224,13 +1228,6 @@ function _user_edit_validate($uid, &$edi
     form_set_error('mail', t('The e-mail address %email has been denied access.', array('%email' => theme('placeholder', $edit['mail']))));
   }
 
-  // Validate the user roles:
-  if (user_access('administer access control') && $_GET['q'] != 'admin/user/create') {
-    if (!$edit['roles']) {
-      form_set_error('roles', t('You must select at least one role.'));
-    }
-  }
-
   // If required, validate the uploaded picture.
   if ($file = file_check_upload('picture')) {
     user_validate_picture($file, $edit, $user);
@@ -1707,9 +1704,6 @@ function user_admin_role() {
       db_query('DELETE FROM {users_roles} WHERE rid = %d AND uid IN (%s)', $id, implode(', ', $uid));
     }
 
-    // Users with only the deleted role are put back in the authenticated users pool.
-    db_query('UPDATE {users_roles} SET rid = %d WHERE rid = %d', _user_authenticated_id(), $id);
-
     drupal_set_message(t('The role has been deleted.'));
     drupal_goto('admin/access/roles');
   }
@@ -1871,7 +1865,7 @@ function user_help($section) {
       return t('<p>Roles allow you to fine tune the security and administration of drupal. A role defines a group of users that have certain privileges as defined in <a href="%permissions">user permissions</a>. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the <em>role names</em> of the various roles. To delete a role choose "edit".</p><p>By default, Drupal comes with two user roles:</p>
       <ul>
       <li>Anonymous user: this role is used for users that don\'t have a user account or that are not authenticated.</li>
-      <li>Authenticated user: this role is assigned automatically to authenticated users. Most registered users will belong to this user role unless specified otherwise.</li>
+      <li>Authenticated user: this role is assigned automatically to authenticated users.</li>
       </ul>', array('%permissions' => url('admin/access/permissions')));
     case 'admin/user/search':
       return t('<p>Enter a simple pattern ("*" may be used as a wildcard match) to search for a username.  For example, one may search for "br" and Drupal might return "brian", "brad", and "brenda".</p>');
