From 8231097ca40cf7c60798a91274284ceed8451ecc Mon Sep 17 00:00:00 2001 From: Ben Klang Date: Sat, 2 Jan 2010 12:13:49 -0500 Subject: [PATCH] Vilma: Move perms to the Vilma_Application class --- vilma/lib/Application.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ vilma/lib/api.php | 27 +-------------------------- 2 files changed, 48 insertions(+), 26 deletions(-) create mode 100644 vilma/lib/Application.php diff --git a/vilma/lib/Application.php b/vilma/lib/Application.php new file mode 100644 index 000000000..f92e41e1e --- /dev/null +++ b/vilma/lib/Application.php @@ -0,0 +1,47 @@ + + * + * 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 + * @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 diff --git a/vilma/lib/api.php b/vilma/lib/api.php index 465fd1fb0..d3cc2219b 100644 --- a/vilma/lib/api.php +++ b/vilma/lib/api.php @@ -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 + * @author Ben Klang * @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'; -- 2.11.0