From 1714871fc4a30e1a9f079b0e68290a6fad80a32c Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 31 May 2010 22:34:35 -0600 Subject: [PATCH] Move application auth driver to horde/Core --- framework/Auth/lib/Horde/Auth.php | 17 +++++++----- framework/Auth/package.xml | 6 +++-- .../lib/Horde/Core}/Auth/Application.php | 30 +++++++++------------- framework/Core/package.xml | 5 +++- 4 files changed, 31 insertions(+), 27 deletions(-) rename framework/{Auth/lib/Horde => Core/lib/Horde/Core}/Auth/Application.php (93%) diff --git a/framework/Auth/lib/Horde/Auth.php b/framework/Auth/lib/Horde/Auth.php index 9d394d955..5e522d788 100644 --- a/framework/Auth/lib/Horde/Auth.php +++ b/framework/Auth/lib/Horde/Auth.php @@ -98,24 +98,29 @@ class Horde_Auth * Attempts to return a concrete Horde_Auth_Base instance based on * $driver. * - * @param mixed $driver The type of concrete Horde_Auth_Base subclass - * to return. - * @param array $params A hash containing any additional configuration or - * parameters a subclass might need. + * @param string $driver Either a driver name, or the full class name to + * use (class must extend Horde_Auth_Base). + * @param array $params A hash containing any additional configuration + * or parameters a subclass might need. * * @return Horde_Auth_Base The newly created concrete instance. * @throws Horde_Auth_Exception */ static public function factory($driver, $params = null) { - $driver = str_replace(' ', '_' , ucwords(str_replace('_', ' ', basename($driver)))); + /* Base drivers (in Auth/ directory). */ $class = __CLASS__ . '_' . $driver; + if (class_exists($class)) { + return new $class($params); + } + /* Explicit class name, */ + $class = $driver; if (class_exists($class)) { return new $class($params); } - throw new Horde_Auth_Exception('Class definition of ' . $class . ' not found.'); + throw new Horde_Auth_Exception(__CLASS__ . ': Class definition of ' . $driver . ' not found.'); } /** diff --git a/framework/Auth/package.xml b/framework/Auth/package.xml index 5fc9525f6..6bd59ddb0 100644 --- a/framework/Auth/package.xml +++ b/framework/Auth/package.xml @@ -48,7 +48,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> - @@ -127,6 +126,10 @@ http://pear.php.net/dtd/package-2.0.xsd"> + Db + pear.horde.org + + Form pear.horde.org @@ -164,7 +167,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> - diff --git a/framework/Auth/lib/Horde/Auth/Application.php b/framework/Core/lib/Horde/Core/Auth/Application.php similarity index 93% rename from framework/Auth/lib/Horde/Auth/Application.php rename to framework/Core/lib/Horde/Core/Auth/Application.php index 84eaa57d7..4074965ec 100644 --- a/framework/Auth/lib/Horde/Auth/Application.php +++ b/framework/Core/lib/Horde/Core/Auth/Application.php @@ -1,6 +1,6 @@ * @category Horde * @license http://opensource.org/licenses/lgpl-2.1.php LGPL - * @package Auth + * @package Core */ -class Horde_Auth_Application extends Horde_Auth_Base +class Horde_Core_Auth_Application extends Horde_Auth_Base { /** * Cache for hasCapability(). @@ -134,11 +134,9 @@ class Horde_Auth_Application extends Horde_Auth_Base */ public function listUsers() { - if ($this->hasCapability('list')) { - return $GLOBALS['registry']->callAppMethod($this->_app, $this->_apiMethods['list']); - } else { - return parent::listUsers(); - } + return $this->hasCapability('list') + ? $GLOBALS['registry']->callAppMethod($this->_app, $this->_apiMethods['list']) + : parent::listUsers(); } /** @@ -150,11 +148,9 @@ class Horde_Auth_Application extends Horde_Auth_Base */ public function exists($userId) { - if ($this->hasCapability('exists')) { - return $GLOBALS['registry']->callAppMethod($this->_app, $this->_apiMethods['exists'], array('args' => array($userId))); - } else { - return parent::exists($userId); - } + return $this->hasCapability('exists') + ? $GLOBALS['registry']->callAppMethod($this->_app, $this->_apiMethods['exists'], array('args' => array($userId))) + : parent::exists($userId); } /** @@ -203,11 +199,9 @@ class Horde_Auth_Application extends Horde_Auth_Base */ public function resetPassword($userId) { - if ($this->hasCapability('resetpassword')) { - return $GLOBALS['registry']->callAppMethod($this->_app, $this->_apiMethods['resetpassword'], array('args' => array($userId))); - } - - return parent::resetPassword(); + return $this->hasCapability('resetpassword') + ? $GLOBALS['registry']->callAppMethod($this->_app, $this->_apiMethods['resetpassword'], array('args' => array($userId))) + : parent::resetPassword(); } /** diff --git a/framework/Core/package.xml b/framework/Core/package.xml index 292879e8d..de76dfa69 100644 --- a/framework/Core/package.xml +++ b/framework/Core/package.xml @@ -37,7 +37,8 @@ Application Framework. beta LGPL - * Import signup code from horde/Auth. + * Import application auth driver from horde/Auth. + * Import signup code from horde/Auth. * Import Horde backend driver from horde/LoginTasks. * Import perms UI handling class from horde/Perms. * Import prefs UI handling class from horde/Prefs. @@ -62,6 +63,7 @@ Application Framework. + @@ -263,6 +265,7 @@ Application Framework. + -- 2.11.0