Vilma: Move perms to the Vilma_Application class
authorBen Klang <ben@alkaloid.net>
Sat, 2 Jan 2010 17:13:49 +0000 (12:13 -0500)
committerBen Klang <ben@alkaloid.net>
Sat, 2 Jan 2010 17:13:49 +0000 (12:13 -0500)
vilma/lib/Application.php [new file with mode: 0644]
vilma/lib/api.php

diff --git a/vilma/lib/Application.php b/vilma/lib/Application.php
new file mode 100644 (file)
index 0000000..f92e41e
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Shout application interface.
+ *
+ * This file defines Shout's external API interface.
+ *
+ * Copyright 2006-2010 Alkaloid Networks <http://www.alkaloid.net/>
+ *
+ * See the enclosed file LICENSE for license information (BSD). If you did not
+ * did not receive this file, see http://cvs.horde.org/co.php/vilma/LICENSE.
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author  Ben Klang <ben@alkaloid.net>
+ * @package Vilma
+ */
+define('VILMA_BASE', dirname(__FILE__) . '/..');
+
+class Vilma_Application extends Horde_Registry_Application
+{
+
+    public function perms()
+    {
+        static $perms = array();
+        if (!empty($perms)) {
+            return $perms;
+        }
+
+        require_once VILMA_BASE . '/lib/base.php';
+        global $vilma_driver;
+
+        $perms['tree']['vilma']['superadmin'] = false;
+        $perms['title']['vilma:superadmin'] = _("Super Administrator");
+
+        $domains = $vilma_driver->getDomains();
+
+        // Run through every domain
+        foreach ($domains as $domain) {
+            $d = $domain['domain_id'];
+            $perms['tree']['vilma']['domains'][$d] = false;
+            $perms['title']['vilma:domains:' . $d] = $domain['name'];
+        }
+
+        return $perms;
+    }
+}
\ No newline at end of file
index 465fd1f..d3cc221 100644 (file)
@@ -13,7 +13,7 @@
  * See the enclosed file COPYING for license information (GPL). If you
  * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
  *
- * @author  Ben Klang <bklang@alkaloid.net>
+ * @author  Ben Klang <ben@alkaloid.net>
  * @package Vilma
  */
 @define('VILMA_BASE', dirname(__FILE__) . '/..');
@@ -27,31 +27,6 @@ $_services['listDomains'] = array(
     'args' => array(),
     'type' => '{urn:horde}stringArray');
 
-function _vilma_perms()
-{
-    static $perms = array();
-    if (!empty($perms)) {
-        return $perms;
-    }
-
-    require_once VILMA_BASE . '/lib/base.php';
-    global $vilma_driver;
-
-    $perms['tree']['vilma']['superadmin'] = false;
-    $perms['title']['vilma:superadmin'] = _("Super Administrator");
-
-    $domains = $vilma_driver->getDomains();
-
-    // Run through every domain
-    foreach ($domains as $domain) {
-        $d = $domain['domain_id'];
-        $perms['tree']['vilma']['domains'][$d] = false;
-        $perms['title']['vilma:domains:' . $d] = $domain['name'];
-    }
-
-    return $perms;
-}
-
 function _vilma_listDomains()
 {
     require_once VILMA_BASE . '/lib/base.php';