From 7679a55aa7f1016e45ccf4df79b7e41440c9cce6 Mon Sep 17 00:00:00 2001 From: Vincent Zanotti Date: Sat, 11 Apr 2009 03:16:19 +0200 Subject: [PATCH] Simplifies some of the GoogleApps hooks by using new "account" idioms. Cleans up a bit the admin/user page, and adds a few TODOs. Signed-off-by: Vincent Zanotti --- include/googleapps.inc.php | 12 +----------- modules/admin.php | 8 +++++++- templates/admin/utilisateurs.tpl | 41 ++++++++++++++++++++++------------------ 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/include/googleapps.inc.php b/include/googleapps.inc.php index d107e5e..b90a749 100644 --- a/include/googleapps.inc.php +++ b/include/googleapps.inc.php @@ -339,17 +339,7 @@ class GoogleAppsAccount if (!$this->pending_update_suspension) { if ($this->sync_password) { - $res = XDB::query( - "SELECT password - FROM accounts - WHERE uid = {?}", $this->user->id()); - $password = ($res->numRows() > 0 ? $res->fetchOneCell() : false); - } else { - $password = false; - } - - if ($password) { - $this->create_queue_job('u_update', array('suspended' => false, 'password' => $password)); + $this->create_queue_job('u_update', array('suspended' => false, 'password' => $this->user->password())); } else { $this->create_queue_job('u_update', array('suspended' => false)); } diff --git a/modules/admin.php b/modules/admin.php index ace6288..82344c7 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -419,6 +419,11 @@ class AdminModule extends PLModule } if (!Post::blank('hashpass')) { $to_update['password'] = Post::s('hashpass'); + // TODO: Propagate the password update to GoogleApps, when required. Eg: + // $account = new GoogleAppsAccount($user); + // if ($account->active() && $account->sync_password) { + // $account->set_password($pass_encrypted); + // } } if (!Post::blank('weak_password')) { $to_update['weak_password'] = Post::s('weak_password'); @@ -450,6 +455,8 @@ class AdminModule extends PLModule } } if (!empty($to_update)) { + // TODO: fetch the initial values of the fields, and eventually send + // a summary of the changes to an admin. $set = array(); foreach ($to_update as $k => $value) { $set[] = XDB::format($k . ' = {?}', $value); @@ -615,7 +622,6 @@ class AdminModule extends PLModule $page->assign('emails', $redirect->emails); } - $page->assign('mr', $mr); $page->assign('user', $user); // Displays forum bans. diff --git a/templates/admin/utilisateurs.tpl b/templates/admin/utilisateurs.tpl index 9440b00..cf0beb8 100644 --- a/templates/admin/utilisateurs.tpl +++ b/templates/admin/utilisateurs.tpl @@ -86,11 +86,13 @@ $(document).ready(function() { {/literal}
- + Compte de {$user->login()}. + +
@@ -101,7 +103,7 @@ $(document).ready(function() { depuis {$host}.

- +
+ + +
@@ -215,19 +217,22 @@ $(document).ready(function() {
+ {* TODO: on 'update_account', update the hashpass field before sending the form. *} + + + +
-
-
- - -

Fiches associées au compte

{xsrf_token_field} - +
@@ -394,11 +399,11 @@ Pour ceci changer ses permissions en 'disabled'. -->
-

Gestion de l'adresse X.org {$user->login()}

+

Gestion de l'adresse X.org

{xsrf_token_field} -
Identifiant de la fiche
+
Alias email de l'utilisateur @@ -474,7 +479,7 @@ Pour ceci changer ses permissions en 'disabled'. {if $mail->broken}{/if} - {if $mail->email == 'googleapps'}{/if} + {if $mail->email == 'googleapps'}{/if} {$mail->display_email} {if $mail->email == 'googleapps'}{/if} {if $mail->broken} (en panne){/if} @@ -533,7 +538,7 @@ Pour ceci changer ses permissions en 'disabled'.

Autres adresses de l'utilisateur

- +
{foreach from=$virtuals item=virtual} @@ -546,11 +551,11 @@ Pour ceci changer ses permissions en 'disabled'.
-

Gestion de l'accès au forums de {$user->login()}

+

Gestion de l'accès au forums

{xsrf_token_field} -
Virtual aliases auquel l'utilisateur appartient
+
Permissions sur les forums -- 2.1.4