gapps.php
来自「Bug tracker, and reporter.」· PHP 代码 · 共 1,074 行 · 第 1/3 页
PHP
1,074 行
* @return Zend_Gdata_Gapps_UserFeed Collection of Zend_Gdata_UserEntry * objects representing all users in the domain. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function retrieveAllUsers () { return $this->retrieveAllEntriesForFeed($this->retrievePageOfUsers()); } /** * Overwrite a specified username with the provided UserEntry. The * UserEntry does not need to contain an edit link. * * This method is provided for compliance with the Google Apps * Provisioning API specification. Normally users will instead want to * call UserEntry::save() instead. * * @see Zend_Gdata_App_Entry::save * @param string $username The username whose data will be overwritten. * @param Zend_Gdata_Gapps_UserEntry $userEntry The user entry which * will be overwritten. * @return Zend_Gdata_Gapps_UserEntry The UserEntry returned by the * server. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function updateUser($username, $userEntry) { return $this->updateEntry($userEntry, $this->getBaseUrl() . self::APPS_USER_PATH . '/' . $username); } /** * Mark a given user as suspended. * * @param string $username The username associated with the user who * should be suspended. * @return Zend_Gdata_Gapps_UserEntry The UserEntry for the modified * user. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function suspendUser($username) { $user = $this->retrieveUser($username); $user->login->suspended = true; return $user->save(); } /** * Mark a given user as not suspended. * * @param string $username The username associated with the user who * should be restored. * @return Zend_Gdata_Gapps_UserEntry The UserEntry for the modified * user. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function restoreUser($username) { $user = $this->retrieveUser($username); $user->login->suspended = false; return $user->save(); } /** * Delete a user by username. * * @param string $username The username associated with the user who * should be deleted. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function deleteUser($username) { $this->delete($this->getBaseUrl() . self::APPS_USER_PATH . '/' . $username); } /** * Create a nickname for a given user. * * @param string $username The username to which the new nickname should * be associated. * @param string $nickname The new nickname to be created. * @return Zend_Gdata_Gapps_NicknameEntry The nickname entry which was * created by the server. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function createNickname($username, $nickname) { $entry = $this->newNicknameEntry(); $nickname = $this->newNickname($nickname); $login = $this->newLogin($username); $entry->nickname = $nickname; $entry->login = $login; return $this->insertNickname($entry); } /** * Retrieve the entry for a specified nickname. * * @param string $nickname The nickname to be retrieved. * @return Zend_Gdata_Gapps_NicknameEntry The requested nickname entry. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function retrieveNickname($nickname) { $query = $this->newNicknameQuery(); $query->setNickname($nickname); try { $nickname = $this->getNicknameEntry($query); } catch (Zend_Gdata_Gapps_ServiceException $e) { // Set the nickname to null if not found if ($e->hasError(Zend_Gdata_Gapps_Error::ENTITY_DOES_NOT_EXIST)) { $nickname = null; } else { throw $e; } } return $nickname; } /** * Retrieve all nicknames associated with a specific username. * * @param string $username The username whose nicknames should be * returned. * @return Zend_Gdata_Gapps_NicknameFeed A feed containing all nicknames * for the given user, or null if * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function retrieveNicknames($username) { $query = $this->newNicknameQuery(); $query->setUsername($username); $nicknameFeed = $this->retrieveAllEntriesForFeed( $this->getNicknameFeed($query)); return $nicknameFeed; } /** * Retrieve a page of nicknames in alphabetical order, starting with the * provided nickname. * * @param string $startNickname (optional) The first nickname to * retrieve. If null or not declared, the page will begin with * the first nickname in the domain. * @return Zend_Gdata_Gapps_NicknameFeed Collection of Zend_Gdata_NicknameEntry * objects representing all nicknames in the domain. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function retrievePageOfNicknames ($startNickname = null) { $query = $this->newNicknameQuery(); $query->setStartNickname($startNickname); return $this->getNicknameFeed($query); } /** * Retrieve all nicknames in the current domain. Be aware that * calling this function on a domain with many nicknames will take a * signifigant amount of time to complete. On larger domains this may * may cause execution to timeout without proper precautions in place. * * @return Zend_Gdata_Gapps_NicknameFeed Collection of Zend_Gdata_NicknameEntry * objects representing all nicknames in the domain. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function retrieveAllNicknames () { return $this->retrieveAllEntriesForFeed($this->retrievePageOfNicknames()); } /** * Delete a specified nickname. * * @param string $nickname The name of the nickname to be deleted. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function deleteNickname($nickname) { $this->delete($this->getBaseUrl() . self::APPS_NICKNAME_PATH . '/' . $nickname); } /** * Create a new email list. * * @param string $emailList The name of the email list to be created. * @return Zend_Gdata_Gapps_EmailListEntry The email list entry * as created on the server. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function createEmailList($emailList) { $entry = $this->newEmailListEntry(); $list = $this->newEmailList(); $list->name = $emailList; $entry->emailList = $list; return $this->insertEmailList($entry); } /** * Retrieve all email lists associated with a recipient. * * @param string $username The recipient whose associated email lists * should be returned. * @return Zend_Gdata_Gapps_EmailListFeed The list of email lists found as * Zend_Gdata_EmailListEntry objects. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function retrieveEmailLists($recipient) { $query = $this->newEmailListQuery(); $query->recipient = $recipient; return $this->getEmailListFeed($query); } /** * Retrieve a page of email lists in alphabetical order, starting with the * provided email list. * * @param string $startEmailListName (optional) The first list to * retrieve. If null or not defined, the page will begin * with the first email list in the domain. * @return Zend_Gdata_Gapps_EmailListFeed Collection of Zend_Gdata_EmailListEntry * objects representing all nicknames in the domain. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function retrievePageOfEmailLists ($startNickname = null) { $query = $this->newEmailListQuery(); $query->setStartEmailListName($startNickname); return $this->getEmailListFeed($query); } /** * Retrieve all email lists associated with the curent domain. Be aware that * calling this function on a domain with many email lists will take a * signifigant amount of time to complete. On larger domains this may * may cause execution to timeout without proper precautions in place. * * @return Zend_Gdata_Gapps_EmailListFeed The list of email lists found * as Zend_Gdata_Gapps_EmailListEntry objects. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function retrieveAllEmailLists() { return $this->retrieveAllEntriesForFeed($this->retrievePageOfEmailLists()); } /** * Delete a specified email list. * * @param string $emailList The name of the emailList to be deleted. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function deleteEmailList($emailList) { $this->delete($this->getBaseUrl() . self::APPS_EMAIL_LIST_PATH . '/' . $emailList); } /** * Add a specified recipient to an existing emailList. * * @param string $recipientAddress The address of the recipient to be * added to the email list. * @param string $emailList The name of the email address to which the * recipient should be added. * @return Zend_Gdata_Gapps_EmailListRecipientEntry The recipient entry * created by the server. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function addRecipientToEmailList($recipientAddress, $emailList) { $entry = $this->newEmailListRecipientEntry(); $who = $this->newWho(); $who->email = $recipientAddress; $entry->who = $who; $address = $this->getBaseUrl() . self::APPS_EMAIL_LIST_PATH . '/' . $emailList . self::APPS_EMAIL_LIST_RECIPIENT_POSTFIX . '/'; return $this->insertEmailListRecipient($entry, $address); } /** * Retrieve a page of email list recipients in alphabetical order, * starting with the provided email list recipient. * * @param string $emaiList The email list which should be searched. * @param string $startRecipient (optinal) The address of the first * recipient, or null to start with the first recipient in * the list. * @return Zend_Gdata_Gapps_EmailListRecipientFeed Collection of * Zend_Gdata_EmailListRecipientEntry objects representing all * recpients in the specified list. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function retrievePageOfRecipients ($emailList, $startRecipient = null) { $query = $this->newEmailListRecipientQuery(); $query->setEmailListName($emailList); $query->setStartRecipient($startRecipient); return $this->getEmailListRecipientFeed($query); } /** * Retrieve all recipients associated with an email list. Be aware that * calling this function on a domain with many email lists will take a * signifigant amount of time to complete. On larger domains this may * may cause execution to timeout without proper precautions in place. * * @param string $emaiList The email list which should be searched. * @return Zend_Gdata_Gapps_EmailListRecipientFeed The list of email lists * found as Zend_Gdata_Gapps_EmailListRecipientEntry objects. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function retrieveAllRecipients($emailList) { return $this->retrieveAllEntriesForFeed( $this->retrievePageOfRecipients($emailList)); } /** * Remove a specified recipient from an email list. * * @param string $recipientAddress The recipient to be removed. * @param string $emailList The list from which the recipient should * be removed. * @throws Zend_Gdata_App_Exception * @throws Zend_Gdata_App_HttpException * @throws Zend_Gdata_Gapps_ServiceException */ public function removeRecipientFromEmailList($recipientAddress, $emailList) { $this->delete($this->getBaseUrl() . self::APPS_EMAIL_LIST_PATH . '/' . $emailList . self::APPS_EMAIL_LIST_RECIPIENT_POSTFIX . '/' . $recipientAddress); } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?