Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenaka Moorthi <benaka.moorthi@gmail.com>2013-09-25 14:57:22 +0400
committerBenaka Moorthi <benaka.moorthi@gmail.com>2013-09-25 14:57:22 +0400
commitbd41f1ae0122cd0ae6eb44633e5cd835c000ef18 (patch)
treed6e58b805ec05ae90b43bc36208eadc75dd179d7 /core/Auth.php
parente08998fbf9a99b8ab57fcc4728dad986374b7ec1 (diff)
Remove use of Zend_Auth_Result.
Diffstat (limited to 'core/Auth.php')
-rw-r--r--core/Auth.php72
1 files changed, 57 insertions, 15 deletions
diff --git a/core/Auth.php b/core/Auth.php
index 67edbbabaf..30401d0e04 100644
--- a/core/Auth.php
+++ b/core/Auth.php
@@ -39,35 +39,57 @@ interface Auth
*
* @package Piwik
* @subpackage Piwik_Auth
- * @see Zend_AuthResult, libs/Zend/Auth/Result.php
- * @link http://framework.zend.com/manual/en/zend.auth.html
*/
-class AuthResult extends \Zend_Auth_Result
+class AuthResult
{
+ const FAILURE = 0;
+ const SUCCESS = 1;
+ const SUCCESS_SUPERUSER_AUTH_CODE = 42;
+
/**
* token_auth parameter used to authenticate in the API
*
* @var string
*/
- protected $_token_auth = null;
+ protected $tokenAuth = null;
- const SUCCESS_SUPERUSER_AUTH_CODE = 42;
+ /**
+ * The login used to authenticate.
+ *
+ * @var string
+ */
+ protected $login = null;
+
+ /**
+ * The authentication result code. Can be self::FAILURE, self::SUCCESS, or
+ * self::SUCCESS_SUPERUSER_AUTH_CODE.
+ *
+ * @var int
+ */
+ protected $code = null;
/**
* Constructor for AuthResult
*
* @param int $code
* @param string $login identity
- * @param string $token_auth
- * @param array $messages
+ * @param string $tokenAuth
+ */
+ public function __construct($code, $login, $tokenAuth)
+ {
+ $this->code = (int)$code;
+ $this->login = $login;
+ $this->tokenAuth = $tokenAuth;
+ }
+
+ /**
+ * Returns the login used to authenticate.
+ *
+ * @return string
*/
- public function __construct($code, $login, $token_auth, array $messages = array())
+ public function getIdentity()
{
- // AuthResult::SUCCESS_SUPERUSER_AUTH_CODE, AuthResult::SUCCESS, AuthResult::FAILURE
- $this->_code = (int)$code;
- $this->_identity = $login;
- $this->_messages = $messages;
- $this->_token_auth = $token_auth;
+ return $this->login;
}
/**
@@ -77,6 +99,26 @@ class AuthResult extends \Zend_Auth_Result
*/
public function getTokenAuth()
{
- return $this->_token_auth;
+ return $this->tokenAuth;
}
-}
+
+ /**
+ * Returns the authentication result code.
+ *
+ * @return int
+ */
+ public function getCode()
+ {
+ return $this->code;
+ }
+
+ /**
+ * Returns true if this result was successfully authentication.
+ *
+ * @return bool
+ */
+ public function wasAuthenticationSuccessful()
+ {
+ return $this->code > self::FAILURE;
+ }
+} \ No newline at end of file