#319438 by rickcoates, hunmonk: Reset user perm cache after removing auth role.
authorChad Phillips
Tue, 9 Dec 2008 23:54:34 +0000 (23:54 +0000)
committerChad Phillips
Tue, 9 Dec 2008 23:54:34 +0000 (23:54 +0000)
logintoboggan.module

index cac0892..89e51c9 100755 (executable)
@@ -437,6 +437,13 @@ function _logintoboggan_user_roles_alter(&$account) {
   if ($account->uid && $in_pre_auth_role) {
     if ($id != DRUPAL_AUTHENTICATED_RID) {
       unset($account->roles[DRUPAL_AUTHENTICATED_RID]);
+      // Reset the permissions cache.  Since the only
+      // goal here is to reset the cache, create a
+      // temporary account object for uid 1 -- this
+      // results in no hits on the database.
+      $temp_account = new stdClass();
+      $temp_account->uid = 1;
+      user_access('', $temp_account, TRUE);
     }
   }
 }