Adds the list of nicknames to the Google Apps user admin page.
authorVincent Zanotti <vincent.zanotti@m4x.org>
Sun, 17 May 2009 15:40:38 +0000 (17:40 +0200)
committerVincent Zanotti <vincent.zanotti@m4x.org>
Sun, 17 May 2009 15:40:38 +0000 (17:40 +0200)
Signed-off-by: Vincent Zanotti <vincent.zanotti@m4x.org>
include/googleapps.inc.php
templates/googleapps/admin.user.tpl

index 71853c4..accc779 100644 (file)
@@ -119,6 +119,9 @@ class GoogleAppsAccount
     public $r_last_webmail;
     public $reporting_date;
 
+    // Nicknames (aliases) registered for that user, lazily loaded.
+    public $nicknames;
+
     // Pending requests in the gappsd job queue (cf. top note).
     public $pending_create;
     public $pending_delete;
@@ -272,6 +275,21 @@ class GoogleAppsAccount
         return $this->g_status == 'disabled';
     }
 
+    // Loads and returns the list of nicknames for the user.
+    public function nicknames()
+    {
+        if ($this->nicknames == null) {
+            $res = XDB::query(
+                "SELECT  g_nickname
+                   FROM  gapps_nicknames
+                  WHERE  g_account_name = {?}
+               ORDER BY  g_nickname",
+                $this->g_account_name);
+            $this->nicknames = $res->fetchColumn();
+        }
+        return $this->nicknames;
+    }
+
 
     // Changes the GoogleApps password.
     public function set_password($password) {
index 1663dbf..4257288 100644 (file)
   <tr class="pair">
     <td class="titre">Utilisation du quota d'emails</td><td>{$a->r_disk_usage/1024/1024|string_format:"%.2f"}MB</td>
   </tr>
+
+  <tr class="impair">
+    <td class="titre">Alias email du compte</td>
+    <td>{$a->g_account_name}{foreach from=$a->nicknames() item=nickname}<br />{$nickname}{/foreach}</td>
+  </tr>
 </table><br />
 
 <form action="admin/googleapps/user/{$a->g_account_name}" method="post">