perms() API call cleanups
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 8 Sep 2010 22:05:00 +0000 (16:05 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 8 Sep 2010 23:08:01 +0000 (17:08 -0600)
No need to cache - this is done already in the Perms class.

14 files changed:
agora/lib/Application.php
babel/lib/Application.php
beatnik/lib/Application.php
chora/lib/Application.php
gollem/lib/Application.php
hermes/lib/Application.php
news/lib/Application.php
operator/lib/Application.php
shout/lib/Application.php
turba/lib/Application.php
vilma/lib/Application.php
whups/lib/Api.php
whups/lib/Application.php
wicked/lib/Application.php

index eb8f62b..f22ea10 100644 (file)
@@ -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;
index 4450340..fe02895 100644 (file)
@@ -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';
index d93d74e..132fdcf 100644 (file)
@@ -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;
     }
 
     /**
index 8ec9a28..c639333 100644 (file)
@@ -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;
     }
 
index 45c276c..8f62408 100644 (file)
@@ -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(
index 1099ae8..9231303 100644 (file)
@@ -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. */
index 238a3f6..2fe2efb 100644 (file)
@@ -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");
 
index 5d6dc79..49c7150 100644 (file)
@@ -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;
     }
 
 }
index cc5af4c..28f2c44 100644 (file)
@@ -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;
     }
 
 
index 196ca21..ca5e0ca 100644 (file)
@@ -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;
index 49a0eb9..b896042 100644 (file)
@@ -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
+}
index 66f4328..ffb5527 100644 (file)
@@ -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
index 6d53fa2..d1a9bdf 100644 (file)
@@ -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;
     }
 
index 171806c..83aba2b 100644 (file)
@@ -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;
-
     }
 
 }