Avoids disabling the Google Apps account when a user account is disabled.
authorVincent Zanotti <vincent.zanotti@m4x.org>
Mon, 23 Mar 2009 13:47:28 +0000 (14:47 +0100)
committerVincent Zanotti <vincent.zanotti@m4x.org>
Mon, 23 Mar 2009 14:03:53 +0000 (15:03 +0100)
This matches the behavior of email forwarding (requested by Gadz.org).

Also adds a reminder to the admin, so that she doesn't forget to properly remove the forwardings when needed.

Signed-off-by: Vincent Zanotti <vincent.zanotti@m4x.org>
modules/admin.php

index d9b00c8..40df9da 100644 (file)
@@ -552,6 +552,10 @@ class AdminModule extends PLModule
                     // however suits our needs.
                     if ($perms == 'disabled' && $old_fields['perms'] != 'disabled') {
                         kill_sessions();
+
+                        // Also serve a reminder to the admin: disabling an account
+                        // does not deactivate email forwarding.
+                        $page->trigWarning("N'oubliez pas, le cas échéant, de désactiver les redirections et le compte GoogleApps de l'utilisateur.");
                     }
 
                     // Updates the user profile with the new values.
@@ -603,14 +607,6 @@ class AdminModule extends PLModule
                                 $account->set_password($pass_encrypted);
                             }
                         }
-
-                        // If the update did disable the user account, disables
-                        // the Google Apps account as well.
-                        if ($new_fields['perms'] == 'disabled' && $new_fields['perms'] != $old_fields['perms']) {
-                            require_once 'googleapps.inc.php';
-                            $account = new GoogleAppsAccount($user);
-                            $account->suspend();
-                        }
                     }