import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -31,13 +31,14 @@ require_once 'Zend/Gdata/Extension.php';
|
||||
require_once 'Zend/Gdata/Gapps.php';
|
||||
|
||||
/**
|
||||
* Represents the apps:login element used by the Apps data API. This
|
||||
* class is used to describe properties of a user, and is usually contained
|
||||
* within instances of Zene_Gdata_Gapps_UserEntry or any other class
|
||||
* Represents the apps:login element used by the Apps data API. This
|
||||
* class is used to describe properties of a user, and is usually contained
|
||||
* within instances of Zene_Gdata_Gapps_UserEntry or any other class
|
||||
* which is linked to a particular username.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Gapps
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
@ -46,94 +47,92 @@ class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
|
||||
|
||||
protected $_rootNamespace = 'apps';
|
||||
protected $_rootElement = 'login';
|
||||
|
||||
|
||||
/**
|
||||
* The username for this user. This is used as the user's email address
|
||||
* The username for this user. This is used as the user's email address
|
||||
* and when logging in to Google Apps-hosted services.
|
||||
*
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_username = null;
|
||||
|
||||
|
||||
/**
|
||||
* The password for the user. May be in cleartext or as an SHA-1
|
||||
* The password for the user. May be in cleartext or as an SHA-1
|
||||
* digest, depending on the value of _hashFunctionName.
|
||||
*
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_password = null;
|
||||
|
||||
|
||||
/**
|
||||
* Specifies whether the password stored in _password is in cleartext
|
||||
* or is an SHA-1 digest of a password. If the password is cleartext,
|
||||
* then this should be null. If the password is an SHA-1 digest, then
|
||||
* Specifies whether the password stored in _password is in cleartext
|
||||
* or is an SHA-1 digest of a password. If the password is cleartext,
|
||||
* then this should be null. If the password is an SHA-1 digest, then
|
||||
* this should be set to 'SHA-1'.
|
||||
*
|
||||
*
|
||||
* At the time of writing, no other hash functions are supported
|
||||
*
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_hashFunctionName = null;
|
||||
|
||||
|
||||
/**
|
||||
* True if the user has administrative rights for this domain, false
|
||||
* True if the user has administrative rights for this domain, false
|
||||
* otherwise.
|
||||
*
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_admin = null;
|
||||
|
||||
|
||||
/**
|
||||
* True if the user has agreed to the terms of service for Google Apps,
|
||||
* false otherwise.
|
||||
*
|
||||
*
|
||||
* @var boolean.
|
||||
*/
|
||||
protected $_agreedToTerms = null;
|
||||
|
||||
|
||||
/**
|
||||
* True if this user has been suspended, false otherwise.
|
||||
*
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_suspended = null;
|
||||
|
||||
|
||||
/**
|
||||
* True if the user will be required to change their password at
|
||||
* True if the user will be required to change their password at
|
||||
* their next login, false otherwise.
|
||||
*
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_changePasswordAtNextLogin = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Gapps_Extension_Login object.
|
||||
*
|
||||
* @param string $username (optional) The username to be used for this
|
||||
*
|
||||
* @param string $username (optional) The username to be used for this
|
||||
* login.
|
||||
* @param string $password (optional) The password to be used for this
|
||||
* @param string $password (optional) The password to be used for this
|
||||
* login.
|
||||
* @param string $hashFunctionName (optional) The name of the hash
|
||||
* function used to protect the password, or null if no
|
||||
* has function has been applied. As of this writing,
|
||||
* @param string $hashFunctionName (optional) The name of the hash
|
||||
* function used to protect the password, or null if no
|
||||
* has function has been applied. As of this writing,
|
||||
* the only valid values are 'SHA-1' or null.
|
||||
* @param boolean $admin (optional) Whether the user is an administrator
|
||||
* @param boolean $admin (optional) Whether the user is an administrator
|
||||
* or not.
|
||||
* @param boolean $suspended (optional) Whether this login is suspended or not.
|
||||
* @param boolean $changePasswordAtNextLogin (optional) Whether
|
||||
* the user is required to change their password at their
|
||||
* @param boolean $changePasswordAtNextLogin (optional) Whether
|
||||
* the user is required to change their password at their
|
||||
* next login.
|
||||
* @param boolean $agreedToTerms (optional) Whether the user has
|
||||
* @param boolean $agreedToTerms (optional) Whether the user has
|
||||
* agreed to the terms of service.
|
||||
*/
|
||||
public function __construct($username = null, $password = null,
|
||||
$hashFunctionName = null, $admin = null, $suspended = null,
|
||||
$changePasswordAtNextLogin = null, $agreedToTerms = null)
|
||||
public function __construct($username = null, $password = null,
|
||||
$hashFunctionName = null, $admin = null, $suspended = null,
|
||||
$changePasswordAtNextLogin = null, $agreedToTerms = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Gapps::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct();
|
||||
$this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_username = $username;
|
||||
$this->_password = $password;
|
||||
$this->_hashFunctionName = $hashFunctionName;
|
||||
@ -144,13 +143,13 @@ class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
@ -177,13 +176,13 @@ class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
|
||||
if ($this->_changePasswordAtNextLogin !== null) {
|
||||
$element->setAttribute('changePasswordAtNextLogin', ($this->_changePasswordAtNextLogin ? "true" : "false"));
|
||||
}
|
||||
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
@ -266,8 +265,8 @@ class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's username attribute. This string
|
||||
* is used to uniquely identify the user in this domian and is used
|
||||
* Set the value for this element's username attribute. This string
|
||||
* is used to uniquely identify the user in this domian and is used
|
||||
* to form this user's email address.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
@ -278,7 +277,7 @@ class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
|
||||
$this->_username = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value for this element's password attribute.
|
||||
*
|
||||
@ -291,9 +290,9 @@ class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's password attribute. As of this
|
||||
* writing, this can be either be provided as plaintext or hashed using
|
||||
* the SHA-1 algorithm for protection. If using a hash function,
|
||||
* Set the value for this element's password attribute. As of this
|
||||
* writing, this can be either be provided as plaintext or hashed using
|
||||
* the SHA-1 algorithm for protection. If using a hash function,
|
||||
* this must be indicated by calling setHashFunctionName().
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
@ -317,10 +316,10 @@ class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's hashFunctionName attribute. This
|
||||
* indicates whether the password supplied with setPassword() is in
|
||||
* plaintext or has had a hash function applied to it. If null,
|
||||
* plaintext is assumed. As of this writing, the only valid hash
|
||||
* Set the value for this element's hashFunctionName attribute. This
|
||||
* indicates whether the password supplied with setPassword() is in
|
||||
* plaintext or has had a hash function applied to it. If null,
|
||||
* plaintext is assumed. As of this writing, the only valid hash
|
||||
* function is 'SHA-1'.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
@ -331,7 +330,7 @@ class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
|
||||
$this->_hashFunctionName = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value for this element's admin attribute.
|
||||
*
|
||||
@ -349,7 +348,7 @@ class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's admin attribute. This indicates
|
||||
* Set the value for this element's admin attribute. This indicates
|
||||
* whether this user is an administrator for this domain.
|
||||
*
|
||||
* @param boolean $value The desired value for this attribute.
|
||||
@ -383,7 +382,7 @@ class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's agreedToTerms attribute. This
|
||||
* Set the value for this element's agreedToTerms attribute. This
|
||||
* indicates whether this user has agreed to the terms of service.
|
||||
*
|
||||
* @param boolean $value The desired value for this attribute.
|
||||
@ -417,7 +416,7 @@ class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's suspended attribute. If true, the
|
||||
* Set the value for this element's suspended attribute. If true, the
|
||||
* user will not be able to login to this domain until unsuspended.
|
||||
*
|
||||
* @param boolean $value The desired value for this attribute.
|
||||
@ -451,10 +450,10 @@ class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's changePasswordAtNextLogin attribute.
|
||||
* If true, the user will be forced to set a new password the next
|
||||
* Set the value for this element's changePasswordAtNextLogin attribute.
|
||||
* If true, the user will be forced to set a new password the next
|
||||
* time they login.
|
||||
*
|
||||
*
|
||||
* @param boolean $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface.
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
@ -475,10 +474,10 @@ class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "Username: " . $this->getUsername() .
|
||||
"\nPassword: " . (is_null($this->getPassword()) ? "NOT SET" : "SET") .
|
||||
"\nPassword Hash Function: " . $this->getHashFunctionName() .
|
||||
"\nAdministrator: " . ($this->getAdmin() ? "Yes" : "No") .
|
||||
return "Username: " . $this->getUsername() .
|
||||
"\nPassword: " . (($this->getPassword() === null) ? "NOT SET" : "SET") .
|
||||
"\nPassword Hash Function: " . $this->getHashFunctionName() .
|
||||
"\nAdministrator: " . ($this->getAdmin() ? "Yes" : "No") .
|
||||
"\nAgreed To Terms: " . ($this->getAgreedToTerms() ? "Yes" : "No") .
|
||||
"\nSuspended: " . ($this->getSuspended() ? "Yes" : "No");
|
||||
}
|
||||
|
Reference in New Issue
Block a user