Move perms() into Horde_Registry_Application
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 11 Aug 2009 21:07:49 +0000 (15:07 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 11 Aug 2009 21:07:49 +0000 (15:07 -0600)
20 files changed:
ansel/lib/Api.php
ansel/lib/Application.php
babel/lib/Api.php [deleted file]
babel/lib/Application.php
chora/lib/Api.php [deleted file]
chora/lib/Application.php
gollem/lib/Api.php
gollem/lib/Application.php
imp/lib/Api.php
imp/lib/Application.php
ingo/lib/Api.php
ingo/lib/Application.php
kronolith/lib/Api.php
kronolith/lib/Application.php
nag/lib/Api.php
nag/lib/Application.php
news/lib/Api.php
news/lib/Application.php
turba/lib/Api.php
turba/lib/Application.php

index 51fa728..8fcd2fc 100644 (file)
 class Ansel_Api extends Horde_Registry_Api
 {
     /**
-     * Returns a list of available permissions.
-     *
-     * @return array  An array describing all available permissions.
-     */
-    public function perms()
-    {
-        $perms = array();
-        $perms['tree']['ansel']['admin'] = false;
-        $perms['title']['ansel:admin'] = _("Administrators");
-
-        return $perms;
-    }
-
-    /**
      * Browse through Ansel's gallery tree.
      *
      * @param string $path       The level of the tree to browse.
index 9b521a5..ebe2d97 100644 (file)
@@ -17,6 +17,20 @@ class Ansel_Application extends Horde_Registry_Application
     public $version = 'H4 (2.0-git)';
 
     /**
+     * Returns a list of available permissions.
+     *
+     * @return array  An array describing all available permissions.
+     */
+    public function perms()
+    {
+        $perms = array();
+        $perms['tree']['ansel']['admin'] = false;
+        $perms['title']['ansel:admin'] = _("Administrators");
+
+        return $perms;
+    }
+
+    /**
      * Special preferences handling on update.
      *
      * @param string $item      The preference name.
diff --git a/babel/lib/Api.php b/babel/lib/Api.php
deleted file mode 100644 (file)
index 6e7cb5b..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/**
- * Babel external API interface.
- *
- * This file defines Babel's external API interface. Other applications can
- * interact with Babel through this API.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * @author  Joel Vandal <joel@scopserv.com>
- * @package Babel
- */
-class Babel_Api extends Horde_Registry_Api
-{
-    public function perms()
-    {
-        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) {
-               $perms['tree']['babel']['language'][$langcode] = false;
-               $perms['title']['babel:language:' . $langcode] = sprintf("%s (%s)", $langdesc, $langcode);
-               $perms['type']['babel:language:' . $langcode] = 'boolean';
-        }
-
-        $perms['tree']['babel']['module'] = array();
-        $perms['title']['babel:module'] = _("Modules");
-        $perms['type']['babel:module']  = 'none';
-
-        foreach ($registry->applications as $app => $params) {
-               if ($params['status'] == 'heading' || $params['status'] == 'block') {
-                   continue;
-               }
-
-               if (isset($params['fileroot']) && !is_dir($params['fileroot'])) {
-                   continue;
-               }
-
-               if (preg_match('/_reports$/', $app) || preg_match('/_tools$/', $app)) {
-                   continue;
-               }
-
-               $perms['tree']['babel']['module'][$app] = false;
-               $perms['title']['babel:module:' . $app] = sprintf("%s (%s)", $params['name'], $app);
-               $perms['type']['babel:module:' . $app] = 'boolean';
-        }
-
-        $tabdesc['download']   = _("Download");
-        $tabdesc['upload']     = _("Upload");
-        $tabdesc['stats']      = _("Statistics");
-        $tabdesc['view']       = _("View/Edit");
-        $tabdesc['viewsource'] = _("View Source");
-        $tabdesc['extract']    = _("Extract");
-        $tabdesc['make']       = _("Make");
-        $tabdesc['commit']     = _("Commit");
-        $tabdesc['reset']      = _("Reset");
-
-        foreach ($tabdesc as $cat => $desc) {
-               $perms['tree']['babel'][$cat] = array();
-               $perms['title']['babel:' . $cat] = $desc;
-        }
-
-        return $perms;
-    }
-
-}
index c288dc9..9eb8896 100644 (file)
 class Babel_Application extends Horde_Registry_Application
 {
     public $version = 'H4 (0.1-git)';
+
+    /**
+     * Returns a list of available permissions.
+     *
+     * @return array  An array describing all available permissions.
+     */
+    public function perms()
+    {
+        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) {
+               $perms['tree']['babel']['language'][$langcode] = false;
+               $perms['title']['babel:language:' . $langcode] = sprintf("%s (%s)", $langdesc, $langcode);
+               $perms['type']['babel:language:' . $langcode] = 'boolean';
+        }
+
+        $perms['tree']['babel']['module'] = array();
+        $perms['title']['babel:module'] = _("Modules");
+        $perms['type']['babel:module']  = 'none';
+
+        foreach ($registry->applications as $app => $params) {
+               if ($params['status'] == 'heading' || $params['status'] == 'block') {
+                   continue;
+               }
+
+               if (isset($params['fileroot']) && !is_dir($params['fileroot'])) {
+                   continue;
+               }
+
+               if (preg_match('/_reports$/', $app) || preg_match('/_tools$/', $app)) {
+                   continue;
+               }
+
+               $perms['tree']['babel']['module'][$app] = false;
+               $perms['title']['babel:module:' . $app] = sprintf("%s (%s)", $params['name'], $app);
+               $perms['type']['babel:module:' . $app] = 'boolean';
+        }
+
+        $tabdesc['download']   = _("Download");
+        $tabdesc['upload']     = _("Upload");
+        $tabdesc['stats']      = _("Statistics");
+        $tabdesc['view']       = _("View/Edit");
+        $tabdesc['viewsource'] = _("View Source");
+        $tabdesc['extract']    = _("Extract");
+        $tabdesc['make']       = _("Make");
+        $tabdesc['commit']     = _("Commit");
+        $tabdesc['reset']      = _("Reset");
+
+        foreach ($tabdesc as $cat => $desc) {
+               $perms['tree']['babel'][$cat] = array();
+               $perms['title']['babel:' . $cat] = $desc;
+        }
+
+        return $perms;
+    }
+
 }
diff --git a/chora/lib/Api.php b/chora/lib/Api.php
deleted file mode 100644 (file)
index 25a764f..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
- * Chora external API interface.
- *
- * This file defines Chora's external API interface. Other applications can
- * interact with Chora through this API.
- *
- * @package Chora
- */
-class Chora_Api extends Horde_Registry_Api
-{
-    public function perms()
-    {
-        static $perms = array();
-
-        if (!empty($perms)) {
-            return $perms;
-        }
-
-        require_once dirname(__FILE__) . '/../config/sourceroots.php';
-
-        $perms['tree']['chora']['sourceroots'] = false;
-        $perms['title']['chora:sourceroots'] = _("Repositories");
-
-        // Run through every source repository
-        foreach ($sourceroots as $sourceroot => $srconfig) {
-            $perms['tree']['chora']['sourceroots'][$sourceroot] = false;
-            $perms['title']['chora:sourceroots:' . $sourceroot] = $srconfig['name'];
-        }
-
-        return $perms;
-    }
-
-}
index 8eee943..7a9309e 100644 (file)
@@ -17,6 +17,33 @@ class Chora_Application extends Horde_Registry_Application
     public $version = 'H4 (3.0-git)';
 
     /**
+     * Returns a list of available permissions.
+     *
+     * @return array  An array describing all available permissions.
+     */
+    public function perms()
+    {
+        static $perms = array();
+
+        if (!empty($perms)) {
+            return $perms;
+        }
+
+        require_once dirname(__FILE__) . '/../config/sourceroots.php';
+
+        $perms['tree']['chora']['sourceroots'] = false;
+        $perms['title']['chora:sourceroots'] = _("Repositories");
+
+        // Run through every source repository
+        foreach ($sourceroots as $sourceroot => $srconfig) {
+            $perms['tree']['chora']['sourceroots'][$sourceroot] = false;
+            $perms['title']['chora:sourceroots:' . $sourceroot] = $srconfig['name'];
+        }
+
+        return $perms;
+    }
+
+    /**
      * Generate the menu to use on the prefs page.
      *
      * @return Horde_Menu  A Horde_Menu object.
index d1e1849..d3a5377 100644 (file)
 class Gollem_Api extends Horde_Registry_Api
 {
     /**
-     * TODO
-     */
-    public function perms()
-    {
-        static $perms = array();
-        if (!empty($perms)) {
-            return $perms;
-        }
-
-        require_once dirname(__FILE__) . '/base.load.php';
-        require GOLLEM_BASE . '/config/backends.php';
-
-        $perms['tree']['gollem']['backends'] = false;
-        $perms['title']['gollem:backends'] = _("Backends");
-
-        // Run through every backend.
-        foreach ($backends as $backend => $curBackend) {
-            $perms['tree']['gollem']['backends'][$backend] = false;
-            $perms['title']['gollem:backends:' . $backend] = $curBackend['name'];
-        }
-
-        return $perms;
-    }
-
-    /**
      * Browses through the VFS tree.
      *
      * Each VFS backend is listed as a directory at the top level.  No modify
index 1fd3fd5..c7649a1 100644 (file)
@@ -20,6 +20,33 @@ class Gollem_Application extends Horde_Registry_Application
     public $version = 'H4 (2.0-git)';
 
     /**
+     * Returns a list of available permissions.
+     *
+     * @return array  An array describing all available permissions.
+     */
+    public function perms()
+    {
+        static $perms = array();
+        if (!empty($perms)) {
+            return $perms;
+        }
+
+        require_once dirname(__FILE__) . '/base.load.php';
+        require GOLLEM_BASE . '/config/backends.php';
+
+        $perms['tree']['gollem']['backends'] = false;
+        $perms['title']['gollem:backends'] = _("Backends");
+
+        // Run through every backend.
+        foreach ($backends as $backend => $curBackend) {
+            $perms['tree']['gollem']['backends'][$backend] = false;
+            $perms['title']['gollem:backends:' . $backend] = $curBackend['name'];
+        }
+
+        return $perms;
+    }
+
+    /**
      * Special preferences handling on update.
      *
      * @param string $item      The preference name.
index f90dd63..4153b8d 100644 (file)
  */
 class IMP_Api extends Horde_Registry_Api
 {
-    /* Horde-defined functions. */
-
-    /**
-     * Returns a list of available permissions.
-     *
-     * @return array  The permissions list.
-     */
-    public function perms()
-    {
-        return array(
-            'tree' => array(
-                'imp' => array(
-                     'create_folders' => false,
-                     'max_folders' => false,
-                     'max_recipients' => false,
-                     'max_timelimit' => false,
-                 ),
-            ),
-            'title' => array(
-                'imp:create_folders' => _("Allow Folder Creation?"),
-                'imp:max_folders' => _("Maximum Number of Folders"),
-                'imp:max_recipients' => _("Maximum Number of Recipients per Message"),
-                'imp:max_timelimit' => _("Maximum Number of Recipients per Time Period"),
-            ),
-            'type' => array(
-                'imp:create_folders' => 'boolean',
-                'imp:max_folders' => 'int',
-                'imp:max_recipients' => 'int',
-                'imp:max_timelimit' => 'int',
-            )
-        );
-    }
-
-    /* IMP-specific functions. */
-
     /**
      * Returns a compose window link.
      *
index ef3842c..1cc52bb 100644 (file)
@@ -162,6 +162,39 @@ class IMP_Application extends Horde_Registry_Application
         IMP::initialize();
     }
 
+    /* Horde permissions. */
+
+    /**
+     * Returns a list of available permissions.
+     *
+     * @return array  An array describing all available permissions.
+     */
+    public function perms()
+    {
+        return array(
+            'tree' => array(
+                'imp' => array(
+                     'create_folders' => false,
+                     'max_folders' => false,
+                     'max_recipients' => false,
+                     'max_timelimit' => false,
+                 ),
+            ),
+            'title' => array(
+                'imp:create_folders' => _("Allow Folder Creation?"),
+                'imp:max_folders' => _("Maximum Number of Folders"),
+                'imp:max_recipients' => _("Maximum Number of Recipients per Message"),
+                'imp:max_timelimit' => _("Maximum Number of Recipients per Time Period"),
+            ),
+            'type' => array(
+                'imp:create_folders' => 'boolean',
+                'imp:max_folders' => 'int',
+                'imp:max_recipients' => 'int',
+                'imp:max_timelimit' => 'int',
+            )
+        );
+    }
+
     /* Horde_Auth_Application methods. */
 
     /**
index b874ccf..0724132 100644 (file)
@@ -23,31 +23,6 @@ class Ingo_Api extends Horde_Registry_Api
     );
 
     /**
-     * Returns a list of available permissions.
-     *
-     * @return array  An array describing all available permissions.
-     */
-    public function perms()
-    {
-        return array(
-            'title' => array(
-                'ingo:allow_rules' => _("Allow Rules"),
-                'ingo:max_rules' => _("Maximum Number of Rules")
-            ),
-            'tree' => array(
-                'ingo' => array(
-                    'allow_rules' => false,
-                    'max_rules' => false
-                )
-            ),
-            'type' => array(
-                'ingo:allow_rules' => 'boolean',
-                'ingo:max_rules' => 'int'
-            )
-        );
-    }
-
-    /**
      * Removes user data.
      *
      * @param string $user  Name of user to remove data for.
index 5411618..7191ba2 100644 (file)
@@ -15,6 +15,31 @@ class Ingo_Application extends Horde_Registry_Application
     public $version = 'H4 (2.0-git)';
 
     /**
+     * Returns a list of available permissions.
+     *
+     * @return array  An array describing all available permissions.
+     */
+    public function perms()
+    {
+        return array(
+            'title' => array(
+                'ingo:allow_rules' => _("Allow Rules"),
+                'ingo:max_rules' => _("Maximum Number of Rules")
+            ),
+            'tree' => array(
+                'ingo' => array(
+                    'allow_rules' => false,
+                    'max_rules' => false
+                )
+            ),
+            'type' => array(
+                'ingo:allow_rules' => 'boolean',
+                'ingo:max_rules' => 'int'
+            )
+        );
+    }
+
+    /**
      * Generate the menu to use on the prefs page.
      *
      * @return Horde_Menu  A Horde_Menu object.
index e35755b..2e104ab 100644 (file)
@@ -19,21 +19,6 @@ class Kronolith_Api extends Horde_Registry_Api
     );
 
     /**
-     * Returns a list of available permissions.
-     *
-     * @return array  An array describing all available permissions.
-     */
-    public function perms()
-    {
-        $perms = array();
-        $perms['tree']['kronolith']['max_events'] = false;
-        $perms['title']['kronolith:max_events'] = _("Maximum Number of Events");
-        $perms['type']['kronolith:max_events'] = 'int';
-
-        return $perms;
-    }
-
-    /**
      * Removes user data.
      *
      * @param string $user  Name of user to remove data for.
index 4d8a527..1152fe2 100644 (file)
@@ -9,6 +9,21 @@ class Kronolith_Application extends Horde_Registry_Application
     public $version = 'H3 (3.0-git)';
 
     /**
+     * Returns a list of available permissions.
+     *
+     * @return array  An array describing all available permissions.
+     */
+    public function perms()
+    {
+        $perms = array();
+        $perms['tree']['kronolith']['max_events'] = false;
+        $perms['title']['kronolith:max_events'] = _("Maximum Number of Events");
+        $perms['type']['kronolith:max_events'] = 'int';
+
+        return $perms;
+    }
+
+    /**
      * Code to run when viewing prefs for this application.
      *
      * @param string $group  The prefGroup name.
index cbafad1..cb74fde 100644 (file)
@@ -19,21 +19,6 @@ class Nag_Api extends Horde_Registry_Api
     );
 
     /**
-     * Returns a list of available permissions.
-     *
-     * @return array  An array describing all available permissions.
-     */
-    public function perms()
-    {
-        $perms = array();
-        $perms['tree']['nag']['max_tasks'] = false;
-        $perms['title']['nag:max_tasks'] = _("Maximum Number of Tasks");
-        $perms['type']['nag:max_tasks'] = 'int';
-
-        return $perms;
-    }
-
-    /**
      * Removes user data.
      *
      * @param string $user  Name of user to remove data for.
index b0fbc0a..526eb94 100644 (file)
@@ -14,6 +14,21 @@ class Nag_Application extends Horde_Registry_Application
     public $version = 'H4 (3.0-git)';
 
     /**
+     * Returns a list of available permissions.
+     *
+     * @return array  An array describing all available permissions.
+     */
+    public function perms()
+    {
+        $perms = array();
+        $perms['tree']['nag']['max_tasks'] = false;
+        $perms['title']['nag:max_tasks'] = _("Maximum Number of Tasks");
+        $perms['type']['nag:max_tasks'] = 'int';
+
+        return $perms;
+    }
+
+    /**
      * Special preferences handling on update.
      *
      * @param string $item      The preference name.
index da84576..491cdd4 100644 (file)
 class News_Api extends Horde_Registry_Api
 {
     /**
-     * Categories/Permissions
-     */
-    public function perms()
-    {
-        static $perms = array();
-        if (!empty($perms)) {
-            return $perms;
-        }
-
-        $perms['tree']['news']['admin'] = true;
-        $perms['title']['news:admin'] = _("Admin");
-
-        $perms['tree']['news']['editors'] = true;
-        $perms['title']['news:editors'] = _("Editors");
-
-        require_once dirname(__FILE__) . '/base.php';
-        $tree = $GLOBALS['news_cat']->getEnum();
-
-        $perms['title']['news:categories'] = _("Categories");
-        foreach ($tree as $cat_id => $cat_name) {
-            $perms['tree']['news']['categories'][$cat_id] = false;
-            $perms['title']['news:categories:' . $cat_id] = $cat_name;
-        }
-
-        return $perms;
-    }
-
-    /**
      * Callback for comment API
      *
      * @param int $id        Internal data identifier
index f109d93..7ec790f 100644 (file)
@@ -15,6 +15,36 @@ class News_Application extends Horde_Registry_Application
     public $version = 'H4 (0.1-git)';
 
     /**
+     * Returns a list of available permissions.
+     *
+     * @return array  An array describing all available permissions.
+     */
+    public function perms()
+    {
+        static $perms = array();
+        if (!empty($perms)) {
+            return $perms;
+        }
+
+        $perms['tree']['news']['admin'] = true;
+        $perms['title']['news:admin'] = _("Admin");
+
+        $perms['tree']['news']['editors'] = true;
+        $perms['title']['news:editors'] = _("Editors");
+
+        require_once dirname(__FILE__) . '/base.php';
+        $tree = $GLOBALS['news_cat']->getEnum();
+
+        $perms['title']['news:categories'] = _("Categories");
+        foreach ($tree as $cat_id => $cat_name) {
+            $perms['tree']['news']['categories'][$cat_id] = false;
+            $perms['title']['news:categories:' . $cat_id] = $cat_name;
+        }
+
+        return $perms;
+    }
+
+    /**
      * Generate the menu to use on the prefs page.
      *
      * @return Horde_Menu  A Horde_Menu object.
index caf558e..21dffdb 100644 (file)
@@ -28,36 +28,6 @@ class Turba_Api extends Horde_Registry_Api
     );
 
     /**
-     * Returns a list of available permissions.
-     *
-     * @return array  An array describing all available permissions.
-     */
-    public function perms()
-    {
-        static $perms = array();
-        if (!empty($perms)) {
-            return $perms;
-        }
-
-        require_once dirname(__FILE__) . '/base.php';
-        require TURBA_BASE . '/config/sources.php';
-
-        $perms['tree']['turba']['sources'] = false;
-        $perms['title']['turba:sources'] = _("Sources");
-
-        // Run through every contact source.
-        foreach ($cfgSources as $source => $curSource) {
-            $perms['tree']['turba']['sources'][$source] = false;
-            $perms['title']['turba:sources:' . $source] = $curSource['title'];
-            $perms['tree']['turba']['sources'][$source]['max_contacts'] = false;
-            $perms['title']['turba:sources:' . $source . ':max_contacts'] = _("Maximum Number of Contacts");
-            $perms['type']['turba:sources:' . $source . ':max_contacts'] = 'int';
-        }
-
-        return $perms;
-    }
-
-    /**
      * Removes user data.
      *
      * @param string $user  Name of user to remove data for.
index d176fc9..de2d8cd 100644 (file)
@@ -14,6 +14,36 @@ class Turba_Application extends Horde_Registry_Application
     public $version = 'H3 (3.0-git)';
 
     /**
+     * Returns a list of available permissions.
+     *
+     * @return array  An array describing all available permissions.
+     */
+    public function perms()
+    {
+        static $perms = array();
+        if (!empty($perms)) {
+            return $perms;
+        }
+
+        require_once dirname(__FILE__) . '/base.php';
+        require TURBA_BASE . '/config/sources.php';
+
+        $perms['tree']['turba']['sources'] = false;
+        $perms['title']['turba:sources'] = _("Sources");
+
+        // Run through every contact source.
+        foreach ($cfgSources as $source => $curSource) {
+            $perms['tree']['turba']['sources'][$source] = false;
+            $perms['title']['turba:sources:' . $source] = $curSource['title'];
+            $perms['tree']['turba']['sources'][$source]['max_contacts'] = false;
+            $perms['title']['turba:sources:' . $source . ':max_contacts'] = _("Maximum Number of Contacts");
+            $perms['type']['turba:sources:' . $source . ':max_contacts'] = 'int';
+        }
+
+        return $perms;
+    }
+
+    /**
      * Code to run when viewing prefs for this application.
      *
      * @param string $group  The prefGroup name.