Add perms method and Application class
authorBen Klang <ben@alkaloid.net>
Thu, 31 Dec 2009 21:53:02 +0000 (16:53 -0500)
committerBen Klang <ben@alkaloid.net>
Thu, 31 Dec 2009 21:57:44 +0000 (16:57 -0500)
shout/lib/Application.php [new file with mode: 0644]

diff --git a/shout/lib/Application.php b/shout/lib/Application.php
new file mode 100644 (file)
index 0000000..e0bcf20
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/**
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+define('SHOUT_BASE', dirname(__FILE__) . '/..');
+
+class Shout_Application extends Horde_Registry_Application
+{
+    public $version = 'H4 (1.0-git)';
+    protected $_contexts = null;
+    protected $_extensions = null;
+    protected $_devices = null;
+
+    public function __construct($args = array())
+    {
+
+    }
+
+    public function perms()
+    {
+        static $perms = array();
+        if (!empty($perms)) {
+            return $perms;
+        }
+        
+        require_once dirname(__FILE__) . '/base.php';
+        $shout_contexts = Shout_Driver::factory('storage');
+
+        $perms['tree']['shout']['superadmin'] = false;
+        $perms['title']['shout:superadmin'] = _("Super Administrator");
+
+        $contexts = $shout_contexts->getContexts();
+
+        $perms['tree']['shout']['contexts'] = false;
+        $perms['title']['shout:contexts'] = _("Contexts");
+
+        // Run through every contact source.
+        foreach ($contexts as $context) {
+            $perms['tree']['shout']['contexts'][$context] = false;
+            $perms['title']['shout:contexts:' . $context] = $context;
+
+            foreach(
+                array(
+                    'extensions' => 'Extensions',
+                    'devices' => 'Devices',
+                    'conferences' => 'Conference Rooms',
+                )
+                as $module => $modname) {
+                $perms['tree']['shout']['contexts'][$context][$module] = false;
+                $perms['title']["shout:contexts:$context:$module"] = $modname;
+            }
+        }
+
+    //     function _shout_getContexts($searchfilters = SHOUT_CONTEXT_ALL,
+    //                          $filterperms = null)
+
+        return $perms;
+    }
+}