--- cas.module.orig	2010-09-29 11:29:52.000000000 -0400
+++ cas.module	2010-10-11 09:32:36.377727700 -0400
@@ -220,6 +220,19 @@
     
     $cas_name = phpCAS::getUser();
     
+    $attributes = NULL;
+    // Based on 503414-cas_attributes-3.patch
+    if (method_exists("phpCAS","getAttributes")) {
+      $attributes = phpCAS::getAttributes();
+      // Allow other modules to process attributes. If a module wants to check if
+      // it's a new user then check $_SESSION['cas_first_login']
+      module_invoke_all('process_attributes_cas', $user, $attributes);
+      // now merge in any roles assigned by the hook
+      foreach(array_keys($user->roles) as $role_id) {
+        $cas_roles[$role_id] = $role_id;
+      }
+    }
+
     /*
      * Invoke hook_auth_transform($op, &$username)
      *
@@ -289,6 +302,8 @@
         );
         if (!$cas_authmap) $user_default['authname_cas'] = $cas_name;
         if ($cas_domain) $user_default['mail'] = $cas_name .'@'. $cas_domain;
+        // Allow other modules to modify user properties.
+        module_invoke_all('user_properties_cas', $user_default, $attributes, $cas_name);
         
         // Become user 1 to be able to save profile information
         session_save_session(FALSE);
