From: Michael M Slusarz Date: Wed, 8 Sep 2010 22:05:00 +0000 (-0600) Subject: perms() API call cleanups X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9c0f33973a80a215c92c6d6e3d1c6be5616f3a47;p=horde.git perms() API call cleanups No need to cache - this is done already in the Perms class. --- diff --git a/agora/lib/Application.php b/agora/lib/Application.php index eb8f62b7e..f22ea1071 100644 --- a/agora/lib/Application.php +++ b/agora/lib/Application.php @@ -44,21 +44,12 @@ class Agora_Application extends Horde_Registry_Application public $version = 'H4 (1.0-git)'; /** - * TODO - */ - static protected $_perms = array(); - - /** * Returns a list of available permissions. * * @return array An array describing all available permissions. */ public function perms() { - if (!empty(self::$_perms)) { - return self::$_perms; - } - self::$_perms['tree']['agora']['admin'] = true; self::$_perms['title']['agora:admin'] = _("Admin"); self::$_perms['title']['agora:forums'] = _("Forums"); @@ -67,7 +58,7 @@ class Agora_Application extends Horde_Registry_Application self::$_perms['title']['agora:forums:' . $scope] = $GLOBALS['registry']->get('name', $scope); self::$_perms['tree']['agora']['forums'][$scope] = false; - $forums = &Agora_Messages::singleton($scope); + $forums = Agora_Messages::singleton($scope); $forums_list = $forums->getBareForums(); if (($forums_list instanceof PEAR_Error) || empty($forums_list)) { continue; @@ -77,7 +68,6 @@ class Agora_Application extends Horde_Registry_Application self::$_perms['tree']['agora']['forums'][$scope][$id] = false; self::$_perms['title']['agora:forums:' . $scope . ':' . $id] = $title; } - } return self::$_perms; diff --git a/babel/lib/Application.php b/babel/lib/Application.php index 4450340a3..fe02895dc 100644 --- a/babel/lib/Application.php +++ b/babel/lib/Application.php @@ -20,16 +20,11 @@ class Babel_Application extends Horde_Registry_Application { global $registry; - static $perms = array(); - if (!empty($perms)) { - return $perms; - } - $perms['tree']['babel']['language'] = array(); $perms['title']['babel:language'] = _("Languages"); $perms['type']['babel:language'] = 'none'; - foreach(Horde_Nls::$config['languages'] as $langcode => $langdesc) { + foreach($registry->nlsconfig['languages'] as $langcode => $langdesc) { $perms['tree']['babel']['language'][$langcode] = false; $perms['title']['babel:language:' . $langcode] = sprintf("%s (%s)", $langdesc, $langcode); $perms['type']['babel:language:' . $langcode] = 'boolean'; diff --git a/beatnik/lib/Application.php b/beatnik/lib/Application.php index d93d74ea7..132fdcf0c 100644 --- a/beatnik/lib/Application.php +++ b/beatnik/lib/Application.php @@ -85,23 +85,15 @@ class Beatnik_Application extends Horde_Registry_Application */ public function perms() { - static $perms = array(); + $perms['title']['beatnik:domains'] = _("Domains"); - if (!empty($perms)) { - return $perms; - } - - require_once dirname(__FILE__) . '/base.php'; - - $perms['title']['beatnik:domains'] = _("Domains"); - - // Run through every domain - foreach ($beatnik->driver->getDomains() as $domain) { - $perms['tree']['beatnik']['domains'][$domain['zonename']] = false; - $perms['title']['beatnik:domains:' . $domain['zonename']] = $domain['zonename']; - } + // Run through every domain + foreach ($beatnik->driver->getDomains() as $domain) { + $perms['tree']['beatnik']['domains'][$domain['zonename']] = false; + $perms['title']['beatnik:domains:' . $domain['zonename']] = $domain['zonename']; + } - return $perms; + return $perms; } /** diff --git a/chora/lib/Application.php b/chora/lib/Application.php index 8ec9a2836..c639333ed 100644 --- a/chora/lib/Application.php +++ b/chora/lib/Application.php @@ -41,13 +41,6 @@ class Chora_Application extends Horde_Registry_Application public $version = 'H4 (3.0-git)'; /** - * Permissions cache. - * - * @var array - */ - protected $_permsCache = array(); - - /** * Initialization function. * * Global variables defined: @@ -176,10 +169,6 @@ class Chora_Application extends Horde_Registry_Application */ public function perms() { - if (!empty($this->_permsCache)) { - return $this->_permsCache; - } - $perms['tree']['chora']['sourceroots'] = false; $perms['title']['chora:sourceroots'] = _("Repositories"); @@ -190,8 +179,6 @@ class Chora_Application extends Horde_Registry_Application $perms['title']['chora:sourceroots:' . $sourceroot] = $srconfig['name']; } - $this->_permsCache = $perms; - return $perms; } diff --git a/gollem/lib/Application.php b/gollem/lib/Application.php index 45c276c36..8f6240886 100644 --- a/gollem/lib/Application.php +++ b/gollem/lib/Application.php @@ -73,10 +73,6 @@ class Gollem_Application extends Horde_Registry_Application */ public function perms() { - if (!empty($this->_permsCache)) { - return $this->_permsCache; - } - $perms = array( 'tree' => array( 'gollem' => array( diff --git a/hermes/lib/Application.php b/hermes/lib/Application.php index 1099ae8b6..923130380 100644 --- a/hermes/lib/Application.php +++ b/hermes/lib/Application.php @@ -48,11 +48,6 @@ class Hermes_Application extends Horde_Registry_Application static public $driver = null; /** - * TODO - */ - static protected $_perms = array(); - - /** * Initialization function. * * Global variables defined: @@ -72,19 +67,15 @@ class Hermes_Application extends Horde_Registry_Application */ public function perms() { - if (!empty(self::$_perms)) { - return self::$_perms; - } - - self::$_perms = array(); - self::$_perms['tree']['hermes']['review'] = array(); - self::$_perms['title']['hermes:review'] = _("Time Review Screen"); - self::$_perms['tree']['hermes']['deliverables'] = array(); - self::$_perms['title']['hermes:deliverables'] = _("Deliverables"); - self::$_perms['tree']['hermes']['invoicing'] = array(); - self::$_perms['title']['hermes:invoicing'] = _("Invoicing"); - - return self::$_perms; + $perms = array(); + $perms['tree']['hermes']['review'] = array(); + $perms['title']['hermes:review'] = _("Time Review Screen"); + $perms['tree']['hermes']['deliverables'] = array(); + $perms['title']['hermes:deliverables'] = _("Deliverables"); + $perms['tree']['hermes']['invoicing'] = array(); + $perms['title']['hermes:invoicing'] = _("Invoicing"); + + return $perms; } /* Sidebar method. */ diff --git a/news/lib/Application.php b/news/lib/Application.php index 238a3f65b..2fe2efb0a 100644 --- a/news/lib/Application.php +++ b/news/lib/Application.php @@ -21,11 +21,6 @@ class News_Application extends Horde_Registry_Application */ public function perms() { - static $perms = array(); - if (!empty($perms)) { - return $perms; - } - $perms['tree']['news']['admin'] = true; $perms['title']['news:admin'] = _("Admin"); diff --git a/operator/lib/Application.php b/operator/lib/Application.php index 5d6dc7952..49c715098 100644 --- a/operator/lib/Application.php +++ b/operator/lib/Application.php @@ -48,11 +48,6 @@ class Operator_Application extends Horde_Registry_Application public $driver = null; /** - * TODO - */ - static protected $_perms = array(); - - /** * Initialization function. * * Global variables defined: @@ -72,20 +67,16 @@ class Operator_Application extends Horde_Registry_Application */ public function perms() { - if (!empty(self::$_perms)) { - return self::$_perms; - } - - self::$_perms['tree']['operator']['accountcodes'] = false; - self::$_perms['title']['operator:accountcodes'] = _("Account Codes"); + $perms['tree']['operator']['accountcodes'] = false; + $perms['title']['operator:accountcodes'] = _("Account Codes"); $accountcodes = Operator::getAccountCodes(); foreach ($accountcodes as $accountcode) { - self::$_perms['tree']['operator']['accountcodes'][$accountcode] = false; - self::$_perms['title']['operator:accountcodes:' . $accountcode] = $accountcode; + $perms['tree']['operator']['accountcodes'][$accountcode] = false; + $perms['title']['operator:accountcodes:' . $accountcode] = $accountcode; } - return self::$_perms; + return $perms; } } diff --git a/shout/lib/Application.php b/shout/lib/Application.php index cc5af4c87..28f2c443a 100644 --- a/shout/lib/Application.php +++ b/shout/lib/Application.php @@ -68,11 +68,6 @@ class Shout_Application extends Horde_Registry_Application public $vfs = null; /** - * TODO - */ - static protected $_perms = array(); - - /** * Initialization function. * * Global variables defined: @@ -124,22 +119,18 @@ class Shout_Application extends Horde_Registry_Application */ public function perms() { - if (!empty(self::$_perms)) { - return self::$_perms; - } - - self::$_perms['tree']['shout']['superadmin'] = false; - self::$_perms['title']['shout:superadmin'] = _("Super Administrator"); + $perms['tree']['shout']['superadmin'] = false; + $perms['title']['shout:superadmin'] = _("Super Administrator"); $accounts = $this->storage->getAccounts(); - self::$_perms['tree']['shout']['accounts'] = false; - self::$_perms['title']['shout:accounts'] = _("Accounts"); + $perms['tree']['shout']['accounts'] = false; + $perms['title']['shout:accounts'] = _("Accounts"); // Run through every contact source. foreach ($accounts as $code => $info) { - self::$_perms['tree']['shout']['accounts'][$code] = false; - self::$_perms['title']['shout:accounts:' . $code] = $info['name']; + $perms['tree']['shout']['accounts'][$code] = false; + $perms['title']['shout:accounts:' . $code] = $info['name']; foreach( array( @@ -148,12 +139,12 @@ class Shout_Application extends Horde_Registry_Application 'conferences' => 'Conference Rooms', ) as $module => $modname) { - self::$_perms['tree']['shout']['accounts'][$code][$module] = false; - self::$_perms['title']["shout:accounts:$code:$module"] = $modname; + $perms['tree']['shout']['accounts'][$code][$module] = false; + $perms['title']["shout:accounts:$code:$module"] = $modname; } } - return self::$_perms; + return $perms; } diff --git a/turba/lib/Application.php b/turba/lib/Application.php index 196ca21e4..ca5e0ca8e 100644 --- a/turba/lib/Application.php +++ b/turba/lib/Application.php @@ -147,11 +147,6 @@ class Turba_Application extends Horde_Registry_Application */ public function perms() { - static $perms = array(); - if (!empty($perms)) { - return $perms; - } - require TURBA_BASE . '/config/sources.php'; $perms['tree']['turba']['sources'] = false; diff --git a/vilma/lib/Application.php b/vilma/lib/Application.php index 49a0eb928..b89604299 100644 --- a/vilma/lib/Application.php +++ b/vilma/lib/Application.php @@ -19,7 +19,6 @@ define('VILMA_BASE', dirname(__FILE__) . '/..'); class Vilma_Application extends Horde_Registry_Application { - public $driver = null; public $curdomain = null; @@ -33,11 +32,6 @@ class Vilma_Application extends Horde_Registry_Application public function perms() { - static $perms = array(); - if (!empty($perms)) { - return $perms; - } - $perms['tree']['vilma']['superadmin'] = false; $perms['title']['vilma:superadmin'] = _("Super Administrator"); @@ -52,4 +46,4 @@ class Vilma_Application extends Horde_Registry_Application return $perms; } -} \ No newline at end of file +} diff --git a/whups/lib/Api.php b/whups/lib/Api.php index 66f4328f2..ffb552703 100644 --- a/whups/lib/Api.php +++ b/whups/lib/Api.php @@ -609,15 +609,6 @@ class Whups_Api extends Horde_Registry_Api } /** - * Permissions available from Whups - * - * @return array Permissions tree - */ - public function perms() - { - } - - /** * List cost objects * * @param array $criteria The list criteria diff --git a/whups/lib/Application.php b/whups/lib/Application.php index 6d53fa2ec..d1a9bdff5 100644 --- a/whups/lib/Application.php +++ b/whups/lib/Application.php @@ -42,13 +42,6 @@ class Whups_Application extends Horde_Registry_Application public $version = 'H4 (2.0-git)'; /** - * Permissions cache - * - * @var array - */ - protected $_permsCache = array(); - - /** * Whups initialization. * * Global variables defined: @@ -71,10 +64,6 @@ class Whups_Application extends Horde_Registry_Application */ public function perms() { - if (!empty($this->_permsCache)) { - return $this->_permsCache; - } - /* Available Whups permissions. */ $perms['tree']['whups']['admin'] = false; $perms['title']['whups:admin'] = _("Administration"); @@ -116,8 +105,6 @@ class Whups_Application extends Horde_Registry_Application } } - $this->_permsCache = $perms; - return $perms; } diff --git a/wicked/lib/Application.php b/wicked/lib/Application.php index 171806c50..83aba2bb3 100644 --- a/wicked/lib/Application.php +++ b/wicked/lib/Application.php @@ -47,13 +47,6 @@ class Wicked_Application extends Horde_Registry_Application public $version = 'H4 (2.0-git)'; /** - * Permissions cache. - * - * @var array - */ - protected $_permsCache = array(); - - /** * Wicked initialization. * * Global variables defined: @@ -71,10 +64,6 @@ class Wicked_Application extends Horde_Registry_Application */ public function perms() { - if (!empty($this->_permsCache)) { - return $this->_permsCache; - } - $perms['tree']['wicked']['pages'] = array(); $perms['title']['wicked:pages'] = _("Pages"); @@ -93,10 +82,7 @@ class Wicked_Application extends Horde_Registry_Application ksort($perms['tree']['wicked']['pages']); } - $this->_permsCache = $perms; - return $perms; - } }