X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fadmin.php;h=da2bce9778d502fb26b0eca127497f9750a83538;hb=eab2f6f5f15c04fa35a5e5b89e2853370b74a3eb;hp=d9b00c86ed7ed1122735eee7d4bedb5134ba6f99;hpb=2553b7686e0678b8e27858a7c377e73ecb410aec;p=platal.git diff --git a/modules/admin.php b/modules/admin.php index d9b00c8..da2bce9 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -363,6 +363,7 @@ class AdminModule extends PLModule } // Loads the user identity using the environment. + $user = null; if ($login) { $user = User::get($login); } else if (Env::has('user_id')) { @@ -552,6 +553,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. @@ -568,6 +573,12 @@ class AdminModule extends PLModule user_reindex($user->id()); $new_fields = XDB::query($watch_query, $user->id())->fetchOneAssoc(); + // Redacts the password in the notification, to avoid transmitting + // sensitive information by email. + $new_fields['password'] = ($old_fields['password'] != $new_fields['password'] ? 'new' : 'old'); + $old_fields['password'] = 'old'; + + // Notifies the admins of the profile update. $mailer = new PlMailer("admin/useredit.mail.tpl"); $mailer->assign("admin", S::user()->login()); $mailer->assign("user", $user->login()); @@ -603,14 +614,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(); - } } @@ -691,16 +694,19 @@ class AdminModule extends PLModule $page->assign('bans', $bans); } - function getHruid($line, $key) + function getHruid($line, $key, $relation) { - var_dump($line); - if (!isset($line['nom']) || !isset($line['prenom']) || !isset($line['promo'])) { - return null; + $prenom = CSVImporter::getValue($line, 'prenom', $relation['prenom']); + $nom = CSVImporter::getValue($line, 'nom', $relation['nom']); + $promo = CSVImporter::getValue($line, 'promo', $relation['promo']); + + if ($prenom != 'NULL' && $nom != 'NULL' && $promo != 'NULL') { + return make_forlife($prenom, $nom, $promo); } - return make_forlife($line['prenom'], $line['nom'], $line['promo']); + return null; } - function getMatricule($line, $key) + function getMatricule($line, $key, $relation) { $mat = $line['matricule']; $year = intval(substr($mat, 0, 3));