X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fgoogleapps.inc.php;h=accc779e190ec51e5943e5cb087ab7a70883a5c1;hb=7c7d62fce3e3973b576ffbc4051ba443d6a6b849;hp=45337d43d9be7d794ec56a064ef9bfc7cd329919;hpb=bd4f648ba40d48ad6bf8b60d5707f2a9324c450c;p=platal.git diff --git a/include/googleapps.inc.php b/include/googleapps.inc.php index 45337d4..accc779 100644 --- a/include/googleapps.inc.php +++ b/include/googleapps.inc.php @@ -1,6 +1,6 @@ activate_mail_redirection) { require_once('emails.inc.php'); - $storage = new EmailStorage($user->id(), 'googleapps'); + $storage = new EmailStorage($user, 'googleapps'); $storage->activate(); } @@ -74,7 +74,7 @@ function post_queue_u_update($job) { if ($account->active()) { // Re-adds the email redirection (if the user did request it). if ($account->activate_mail_redirection) { - $storage = new EmailStorage($user->id, 'googleapps'); + $storage = new EmailStorage($user, 'googleapps'); $storage->activate(); } @@ -101,7 +101,7 @@ function post_queue_u_update($job) { // TODO(vincent.zanotti): add the url of gappsd, when available. class GoogleAppsAccount { - // User identification: user id, and forlife. + // User identification: user id, and hruid. private $user; public $g_account_name; @@ -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) { @@ -336,7 +354,7 @@ class GoogleAppsAccount if (!$this->pending_update_suspension && !$this->pending_validation_unsuspend) { require_once('validations.inc.php'); - $unsuspend = new GoogleAppsUnsuspendReq($this->user->id()); + $unsuspend = new GoogleAppsUnsuspendReq($this->user); $unsuspend->submit(); $this->pending_validation_unsuspend = true; }