From 56fa0dccda20b9b5c7a57e5c167178feb398ad20 Mon Sep 17 00:00:00 2001 From: ADmad Date: Wed, 8 May 2013 04:10:13 +0530 Subject: [PATCH] Remove unnecessary overriding of '_findUser()' in 'DigestAuthenticate'. --- .../Component/Auth/DigestAuthenticate.php | 34 +++---------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/lib/Cake/Controller/Component/Auth/DigestAuthenticate.php b/lib/Cake/Controller/Component/Auth/DigestAuthenticate.php index 16416fd89dd..a9ffcb0f3df 100644 --- a/lib/Cake/Controller/Component/Auth/DigestAuthenticate.php +++ b/lib/Cake/Controller/Component/Auth/DigestAuthenticate.php @@ -116,7 +116,11 @@ public function getUser(CakeRequest $request) { if (empty($digest)) { return false; } - $user = $this->_findUser($digest['username']); + + list(, $model) = pluginSplit($this->settings['userModel']); + $user = $this->_findUser(array( + $model . '.' . $this->settings['fields']['username'] => $digest['username'] + )); if (empty($user)) { return false; } @@ -128,34 +132,6 @@ public function getUser(CakeRequest $request) { return false; } -/** - * Find a user record using the standard options. - * - * @param string $username The username/identifier. - * @param string $password Unused password, digest doesn't require passwords. - * @return Mixed Either false on failure, or an array of user data. - */ - protected function _findUser($username, $password = null) { - $userModel = $this->settings['userModel']; - list(, $model) = pluginSplit($userModel); - $fields = $this->settings['fields']; - - $conditions = array( - $model . '.' . $fields['username'] => $username, - ); - if (!empty($this->settings['scope'])) { - $conditions = array_merge($conditions, $this->settings['scope']); - } - $result = ClassRegistry::init($userModel)->find('first', array( - 'conditions' => $conditions, - 'recursive' => $this->settings['recursive'] - )); - if (empty($result) || empty($result[$model])) { - return false; - } - return $result[$model]; - } - /** * Gets the digest headers from the request/environment. *