From ef709f2b554aee5c7b9b2d3e075dc9831d4f0081 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 8 Sep 2010 17:07:48 -0600 Subject: [PATCH] Simplify return from the perms() application call. --- agora/lib/Application.php | 32 ++++++++++-------- ansel/lib/Application.php | 10 +++--- babel/lib/Application.php | 67 +++++++++++++++++++------------------ beatnik/lib/Application.php | 11 ++++-- chora/lib/Application.php | 12 ++++--- framework/Perms/lib/Horde/Perms.php | 26 ++++++++++++-- gollem/lib/Application.php | 14 +++----- hermes/lib/Application.php | 20 ++++++----- horde/lib/Application.php | 13 ++++--- imp/lib/Application.php | 30 +++++++---------- ingo/lib/Application.php | 18 ++++------ jonah/lib/Application.php | 50 +++++++++++++-------------- kronolith/lib/Application.php | 12 +++---- mnemo/lib/Application.php | 12 +++---- nag/lib/Application.php | 12 +++---- news/lib/Application.php | 22 +++++++----- operator/lib/Application.php | 12 ++++--- shout/lib/Application.php | 23 ++++++++----- trean/lib/Application.php | 20 +++++------ turba/lib/Application.php | 19 +++++++---- vilma/lib/Application.php | 13 ++++--- whups/lib/Application.php | 43 +++++++++++++----------- wicked/lib/Application.php | 20 ++++++----- 23 files changed, 284 insertions(+), 227 deletions(-) diff --git a/agora/lib/Application.php b/agora/lib/Application.php index f5b47470c..60dc0919d 100644 --- a/agora/lib/Application.php +++ b/agora/lib/Application.php @@ -50,27 +50,31 @@ class Agora_Application extends Horde_Registry_Application */ public function perms() { - self::$_perms['tree']['agora']['admin'] = true; - self::$_perms['title']['agora:admin'] = _("Admin"); - self::$_perms['title']['agora:forums'] = _("Forums"); - + $perms = array( + 'admin' => array( + 'title' => _("Admin") + ), + 'forums' => array( + 'title' => _("Forums") + ) + ); foreach ($GLOBALS['registry']->listApps() as $scope) { - self::$_perms['title']['agora:forums:' . $scope] = $GLOBALS['registry']->get('name', $scope); - self::$_perms['tree']['agora']['forums'][$scope] = false; + $perms['forums:' . $scope] = array( + 'title' => $GLOBALS['registry']->get('name', $scope) + ); $forums = Agora_Messages::singleton($scope); $forums_list = $forums->getBareForums(); - if (($forums_list instanceof PEAR_Error) || empty($forums_list)) { - continue; - } - - foreach ($forums_list as $id => $title) { - self::$_perms['tree']['agora']['forums'][$scope][$id] = false; - self::$_perms['title']['agora:forums:' . $scope . ':' . $id] = $title; + if (!($forums_list instanceof PEAR_Error)) { + foreach ($forums_list as $id => $title) { + $perms['forums:' . $scope . ':' . $id] = array( + 'title' => $title + ); + } } } - return self::$_perms; + return $perms; } /** diff --git a/ansel/lib/Application.php b/ansel/lib/Application.php index c5baf8d0f..5d33b2b30 100644 --- a/ansel/lib/Application.php +++ b/ansel/lib/Application.php @@ -91,11 +91,11 @@ class Ansel_Application extends Horde_Registry_Application */ public function perms() { - $perms = array(); - $perms['tree']['ansel']['admin'] = false; - $perms['title']['ansel:admin'] = _("Administrators"); - - return $perms; + return array( + 'admin' => array( + 'title' => _("Administrators") + ) + ); } /** diff --git a/babel/lib/Application.php b/babel/lib/Application.php index fe02895dc..9b4289515 100644 --- a/babel/lib/Application.php +++ b/babel/lib/Application.php @@ -20,51 +20,54 @@ class Babel_Application extends Horde_Registry_Application { global $registry; - $perms['tree']['babel']['language'] = array(); - $perms['title']['babel:language'] = _("Languages"); - $perms['type']['babel:language'] = 'none'; + $perms = array( + 'language' => array( + 'title' => _("Languages"), + 'type' => 'none' + ), + 'module' => array( + 'title' => _("Modules"), + 'type' => 'none' + ) + ); 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'; + $perms['language:' . $langcode] = array( + 'title' => sprintf("%s (%s)", $langdesc, $langcode), + 'type' => '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') { + if (in_array($params['status'], array('block', 'heading')) || + (isset($params['fileroot']) && !is_dir($params['fileroot'])) || + preg_match('/_[tools|reports]$/', $app)) { 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'; + $perms['module:' . $app] = array( + 'title' => sprintf("%s (%s)", $params['name'], $app), + 'type' => '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"); + $tabdesc = array( + 'download' => _("Download"), + 'upload' => _("Upload"), + 'stats' => _("Statistics"), + 'view' => _("View/Edit"), + 'viewsource' => _("View Source"), + 'extract' => _("Extract"), + 'make' => _("Make"), + 'commit' => _("Commit"), + 'reset' => _("Reset") + ); foreach ($tabdesc as $cat => $desc) { - $perms['tree']['babel'][$cat] = array(); - $perms['title']['babel:' . $cat] = $desc; + $perms[$cat] = array( + 'title' => $desc + ); } return $perms; diff --git a/beatnik/lib/Application.php b/beatnik/lib/Application.php index 1b95ccaf4..8f561e026 100644 --- a/beatnik/lib/Application.php +++ b/beatnik/lib/Application.php @@ -85,12 +85,17 @@ class Beatnik_Application extends Horde_Registry_Application */ public function perms() { - $perms['title']['beatnik:domains'] = _("Domains"); + $perms = array( + 'domains' => array( + 'title' => _("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']; + $perms['domains:' . $domain['zonename']] = array( + 'title' => $domain['zonename']; + ); } return $perms; diff --git a/chora/lib/Application.php b/chora/lib/Application.php index a1cafa21a..1e7db1eb4 100644 --- a/chora/lib/Application.php +++ b/chora/lib/Application.php @@ -169,14 +169,18 @@ class Chora_Application extends Horde_Registry_Application */ public function perms() { - $perms['tree']['chora']['sourceroots'] = false; - $perms['title']['chora:sourceroots'] = _("Repositories"); + $perms = array( + 'sourceroots' => array( + 'title' => _("Repositories") + ) + ); // Run through every source repository require dirname(__FILE__) . '/../config/backends.php'; foreach ($sourceroots as $sourceroot => $srconfig) { - $perms['tree']['chora']['sourceroots'][$sourceroot] = false; - $perms['title']['chora:sourceroots:' . $sourceroot] = $srconfig['name']; + $perms['sourceroots:' . $sourceroot] = array( + 'title' => $srconfig['name'] + ); } return $perms; diff --git a/framework/Perms/lib/Horde/Perms.php b/framework/Perms/lib/Horde/Perms.php index 886447332..d91592b0a 100644 --- a/framework/Perms/lib/Horde/Perms.php +++ b/framework/Perms/lib/Horde/Perms.php @@ -234,10 +234,32 @@ class Horde_Perms { if (!isset($this->_appPerms[$app])) { try { - $this->_appPerms[$app] = $GLOBALS['registry']->callAppMethod($app, 'perms'); + $perms = array( + 'title' => array(), + 'tree' => array( + $app => array() + ), + 'type' => array() + ); + + foreach ($GLOBALS['registry']->callAppMethod($app, 'perms') as $key => $val) { + $ptr = &$perms['tree'][$app]; + foreach (explode(':', $key) as $kval) { + $ptr[$kval] = false; + $ptr = &$perms['tree'][$app]; + } + if (isset($val['title'])) { + $perms['title'][$app . ':' . $key] = $val['title']; + } + if (isset($val['type'])) { + $perms['type'][$app . ':' . $key] = $val['type']; + } + } } catch (Horde_Exception $e) { - $this->_appPerms[$app] = array(); + $perms = array(); } + + $this->_appPerms[$app] = $perms; } return $this->_appPerms[$app]; diff --git a/gollem/lib/Application.php b/gollem/lib/Application.php index 0032bdb81..ede013695 100644 --- a/gollem/lib/Application.php +++ b/gollem/lib/Application.php @@ -74,21 +74,17 @@ class Gollem_Application extends Horde_Registry_Application public function perms() { $perms = array( - 'tree' => array( - 'gollem' => array( - 'backends' => false - ) - ), - 'title' => array( - 'gollem:backends' => _("Backends") + 'backends' => array( + 'title' => _("Backends") ) ); // Run through every backend. require GOLLEM_BASE . '/config/backends.php'; foreach ($backends as $key => $val) { - $perms['tree']['gollem']['backends'][$key] = false; - $perms['title']['gollem:backends:' . $key] = $val['name']; + $perms['backends:' . $key] = array( + 'title' => $val['name'] + ); } return $perms; diff --git a/hermes/lib/Application.php b/hermes/lib/Application.php index 923130380..7f06cfa96 100644 --- a/hermes/lib/Application.php +++ b/hermes/lib/Application.php @@ -67,15 +67,17 @@ class Hermes_Application extends Horde_Registry_Application */ public function 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; + return array( + 'review' => array( + 'title' => _("Time Review Screen") + ), + 'deliverables' => array( + 'title' => _("Deliverables") + ), + 'invoicing' => array( + 'title' => _("Invoicing"); + ) + ); } /* Sidebar method. */ diff --git a/horde/lib/Application.php b/horde/lib/Application.php index 912bdd545..90ce96785 100644 --- a/horde/lib/Application.php +++ b/horde/lib/Application.php @@ -33,13 +33,12 @@ class Horde_Application extends Horde_Registry_Application */ public function perms() { - $perms = array(); - - $perms['tree']['horde']['max_blocks'] = false; - $perms['title']['horde:max_blocks'] = _("Maximum Number of Portal Blocks"); - $perms['type']['horde:max_blocks'] = 'int'; - - return $perms; + return array( + 'max_blocks' => array( + 'title' => _("Maximum Number of Portal Blocks"), + 'type' => 'int' + ) + ); } /** diff --git a/imp/lib/Application.php b/imp/lib/Application.php index b8bf8a02a..61480b5a3 100644 --- a/imp/lib/Application.php +++ b/imp/lib/Application.php @@ -155,25 +155,21 @@ class IMP_Application extends Horde_Registry_Application public function perms() { return array( - 'tree' => array( - 'imp' => array( - 'create_folders' => false, - 'max_folders' => false, - 'max_recipients' => false, - 'max_timelimit' => false, - ), + 'create_folders' => array( + 'title' => _("Allow Folder Creation?"), + 'type' => 'boolean' ), - '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"), + 'max_folders' => array( + 'title' => _("Maximum Number of Folders"), + 'type' => 'int' ), - 'type' => array( - 'imp:create_folders' => 'boolean', - 'imp:max_folders' => 'int', - 'imp:max_recipients' => 'int', - 'imp:max_timelimit' => 'int', + 'max_recipients' => array( + 'title' => _("Maximum Number of Recipients per Message"), + 'type' => 'int' + ), + 'max_timelimit' => array( + 'title' => _("Maximum Number of Recipients per Time Period"), + 'type' => 'int' ) ); } diff --git a/ingo/lib/Application.php b/ingo/lib/Application.php index 89aa3796e..efccc279d 100644 --- a/ingo/lib/Application.php +++ b/ingo/lib/Application.php @@ -101,19 +101,13 @@ class Ingo_Application extends Horde_Registry_Application public function perms() { return array( - 'title' => array( - 'ingo:allow_rules' => _("Allow Rules"), - 'ingo:max_rules' => _("Maximum Number of Rules") + 'allow_rules' => array( + 'title' => _("Allow Rules"), + 'type' => 'boolean' ), - 'tree' => array( - 'ingo' => array( - 'allow_rules' => false, - 'max_rules' => false - ) - ), - 'type' => array( - 'ingo:allow_rules' => 'boolean', - 'ingo:max_rules' => 'int' + 'max_rules' => array( + 'title' => _("Maximum Number of Rules"), + 'type' => 'int' ) ); } diff --git a/jonah/lib/Application.php b/jonah/lib/Application.php index d810f3aba..5a1b09c24 100644 --- a/jonah/lib/Application.php +++ b/jonah/lib/Application.php @@ -44,40 +44,40 @@ class Jonah_Application extends Horde_Registry_Application */ public function perms() { - $news = Jonah_News::factory(); - $channels = $news->getChannels(Jonah::INTERNAL_CHANNEL); - - /* Loop through internal channels and add their ids to the - * perms. */ - $perms = array(); - foreach ($channels as $channel) { - $perms['tree']['jonah']['news']['internal_channels'][$channel['channel_id']] = false; - } - - /* Human names and default permissions. */ - $perms['title']['jonah:admin'] = _("Administrator"); - $perms['tree']['jonah']['admin'] = false; - $perms['title']['jonah:news'] = _("News"); - $perms['tree']['jonah']['news'] = false; - $perms['title']['jonah:news:internal_channels'] = _("Internal Channels"); - $perms['tree']['jonah']['news']['internal_channels'] = false; - $perms['title']['jonah:news:external_channels'] = _("External Channels"); - $perms['tree']['jonah']['news']['external_channels'] = false; + $perms = array( + 'admin' => array( + 'title' => _("Administrator") + ), + 'news' => array( + 'title' => _("News") + ), + 'news:internal_channels' => array( + 'title' => _("Internal Channels") + ), + 'news:external_channels' => array( + 'title' => _("External Channels") + ) + ); /* Loop through internal channels and add them to the perms * titles. */ + $news = Jonah_News::factory(); + $channels = $news->getChannels(Jonah::INTERNAL_CHANNEL); + foreach ($channels as $channel) { - $perms['title']['jonah:news:internal_channels:' . $channel['channel_id']] = $channel['channel_name']; - $perms['tree']['jonah']['news']['internal_channels'][$channel['channel_id']] = false; + $perms['news:internal_channels:' . $channel['channel_id']] = array( + 'title' => $channel['channel_name'] + ); } - $channels = $news->getChannels(Jonah::EXTERNAL_CHANNEL); - /* Loop through external channels and add their ids to the * perms. */ + $channels = $news->getChannels(Jonah::EXTERNAL_CHANNEL); + foreach ($channels as $channel) { - $perms['title']['jonah:news:external_channels:' . $channel['channel_id']] = $channel['channel_name']; - $perms['tree']['jonah']['news']['external_channels'][$channel['channel_id']] = false; + $perms['news:external_channels:' . $channel['channel_id']] = array( + 'title' => $channel['channel_name'] + ); } return $perms; diff --git a/kronolith/lib/Application.php b/kronolith/lib/Application.php index 539542f50..869d8b607 100644 --- a/kronolith/lib/Application.php +++ b/kronolith/lib/Application.php @@ -80,12 +80,12 @@ class Kronolith_Application extends Horde_Registry_Application */ 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; + return array( + 'max_events' => array( + 'title' => _("Maximum Number of Events"), + 'type' => 'int' + ) + ); } /** diff --git a/mnemo/lib/Application.php b/mnemo/lib/Application.php index 37f400ce7..d8e9391bf 100644 --- a/mnemo/lib/Application.php +++ b/mnemo/lib/Application.php @@ -59,12 +59,12 @@ class Mnemo_Application extends Horde_Registry_Application */ public function perms() { - $perms = array(); - $perms['tree']['mnemo']['max_notes'] = false; - $perms['title']['mnemo:max_notes'] = _("Maximum Number of Notes"); - $perms['type']['mnemo:max_notes'] = 'int'; - - return $perms; + return array( + 'max_notes' => array( + 'title' => _("Maximum Number of Notes"), + 'type' => 'int' + ) + ); } /** diff --git a/nag/lib/Application.php b/nag/lib/Application.php index 5e23d4c82..af4f2542a 100644 --- a/nag/lib/Application.php +++ b/nag/lib/Application.php @@ -63,12 +63,12 @@ class Nag_Application extends Horde_Registry_Application */ 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; + return array( + 'max_tasks' => array( + 'title' => _("Maximum Number of Tasks"), + 'type' => 'int' + ) + ); } /** diff --git a/news/lib/Application.php b/news/lib/Application.php index b0e6e43d2..82aa02ff7 100644 --- a/news/lib/Application.php +++ b/news/lib/Application.php @@ -21,19 +21,25 @@ class News_Application extends Horde_Registry_Application */ public function perms() { - $perms['tree']['news']['admin'] = true; - $perms['title']['news:admin'] = _("Admin"); - - $perms['tree']['news']['editors'] = true; - $perms['title']['news:editors'] = _("Editors"); + $perms = array( + 'admin' => array( + 'title' => _("Admin") + ), + 'categories' => array( + 'title' => _("Categories") + ), + 'editors' => array( + 'title' => _("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; + $perms['categories:' . $cat_id] = array( + 'title' => $cat_name + ); } return $perms; diff --git a/operator/lib/Application.php b/operator/lib/Application.php index 49c715098..cbc7a7c12 100644 --- a/operator/lib/Application.php +++ b/operator/lib/Application.php @@ -67,13 +67,17 @@ class Operator_Application extends Horde_Registry_Application */ public function perms() { - $perms['tree']['operator']['accountcodes'] = false; - $perms['title']['operator:accountcodes'] = _("Account Codes"); + $perms = array( + 'accountcodes' => array( + 'title' => _("Account Codes") + ) + ); $accountcodes = Operator::getAccountCodes(); foreach ($accountcodes as $accountcode) { - $perms['tree']['operator']['accountcodes'][$accountcode] = false; - $perms['title']['operator:accountcodes:' . $accountcode] = $accountcode; + $perms['accountcodes:' . $accountcode] = array( + 'title' => $accountcode + ); } return $perms; diff --git a/shout/lib/Application.php b/shout/lib/Application.php index 28f2c443a..936ed74c5 100644 --- a/shout/lib/Application.php +++ b/shout/lib/Application.php @@ -119,18 +119,22 @@ class Shout_Application extends Horde_Registry_Application */ public function perms() { - $perms['tree']['shout']['superadmin'] = false; - $perms['title']['shout:superadmin'] = _("Super Administrator"); + $perms = array( + 'accounts' => array( + 'title' => _("Accounts") + ), + 'superadmin' => array( + 'title' => _("Super Administrator") + ) + ); $accounts = $this->storage->getAccounts(); - $perms['tree']['shout']['accounts'] = false; - $perms['title']['shout:accounts'] = _("Accounts"); - // Run through every contact source. foreach ($accounts as $code => $info) { - $perms['tree']['shout']['accounts'][$code] = false; - $perms['title']['shout:accounts:' . $code] = $info['name']; + $perms['account:' . $code] = array( + 'title' => $info['name'] + ); foreach( array( @@ -139,8 +143,9 @@ class Shout_Application extends Horde_Registry_Application 'conferences' => 'Conference Rooms', ) as $module => $modname) { - $perms['tree']['shout']['accounts'][$code][$module] = false; - $perms['title']["shout:accounts:$code:$module"] = $modname; + $perms['accounts:' . $code . ':' . $module] = array( + 'title' => $modname + ); } } diff --git a/trean/lib/Application.php b/trean/lib/Application.php index 7b7f691dd..c800f84b3 100644 --- a/trean/lib/Application.php +++ b/trean/lib/Application.php @@ -67,16 +67,16 @@ class Trean_Application extends Horde_Registry_Application */ public function perms() { - $perms = array(); - - $perms['tree']['trean']['max_folders'] = false; - $perms['title']['trean:max_folders'] = _("Maximum Number of Folders"); - $perms['type']['trean:max_folders'] = 'int'; - $perms['tree']['trean']['max_bookmarks'] = false; - $perms['title']['trean:max_bookmarks'] = _("Maximum Number of Bookmarks"); - $perms['type']['trean:max_bookmarks'] = 'int'; - - return $perms; + return array( + 'max_bookmarks' => array( + 'title' => _("Maximum Number of Bookmarks"), + 'type' => 'int' + ), + 'max_folders' => array( + 'title' => _("Maximum Number of Folders"), + 'type' => 'int' + ) + ); } /** diff --git a/turba/lib/Application.php b/turba/lib/Application.php index f1608517b..027c63861 100644 --- a/turba/lib/Application.php +++ b/turba/lib/Application.php @@ -149,16 +149,21 @@ class Turba_Application extends Horde_Registry_Application { require TURBA_BASE . '/config/backends.php'; - $perms['tree']['turba']['sources'] = false; - $perms['title']['turba:sources'] = _("Sources"); + $parms = array( + 'sources' => array( + 'title' => _("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'; + $perms['sources:' . $source] = array( + 'title' => $curSource['title'] + ); + $perms['sources:' . $source . ':max_contacts'] = array( + 'title' => _("Maximum Number of Contacts"), + 'type' => 'int' + ); } return $perms; diff --git a/vilma/lib/Application.php b/vilma/lib/Application.php index 71a33c815..c9b5e41d1 100644 --- a/vilma/lib/Application.php +++ b/vilma/lib/Application.php @@ -33,16 +33,19 @@ class Vilma_Application extends Horde_Registry_Application public function perms() { - $perms['tree']['vilma']['superadmin'] = false; - $perms['title']['vilma:superadmin'] = _("Super Administrator"); + $perms = array( + 'superadmin' => array( + 'title' => _("Super Administrator") + ) + ); $domains = $this->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']; + $perms['domains:' . $domain['domain_id']] = array( + 'title' => $domain['name'] + ); } return $perms; diff --git a/whups/lib/Application.php b/whups/lib/Application.php index b71ea34e8..8488a91df 100644 --- a/whups/lib/Application.php +++ b/whups/lib/Application.php @@ -65,20 +65,27 @@ class Whups_Application extends Horde_Registry_Application public function perms() { /* Available Whups permissions. */ - $perms['tree']['whups']['admin'] = false; - $perms['title']['whups:admin'] = _("Administration"); - - $perms['tree']['whups']['hiddenComments'] = false; - $perms['title']['whups:hiddenComments'] = _("Hidden Comments"); - - $perms['tree']['whups']['queues'] = array(); - $perms['title']['whups:queues'] = _("Queues"); + $perms = array( + 'admin' => array( + 'title' => _("Administration") + ), + 'hiddenComments' => array( + 'title' => _("Hidden Comments") + ), + 'queues' => array( + 'title' => _("Queues") + ), + 'replies' => array( + 'title' => _("Form Replies") + ) + ); /* Loop through queues and add their titles. */ $queues = $GLOBALS['whups_driver']->getQueues(); foreach ($queues as $id => $name) { - $perms['tree']['whups']['queues'][$id] = false; - $perms['title']['whups:queues:' . $id] = $name; + $perms['queues:' . $id] = array( + 'title' => $name + ); $entries = array( 'assign' => _("Assign"), @@ -87,21 +94,19 @@ class Whups_Application extends Horde_Registry_Application ); foreach ($entries as $key => $val) { - $perms['tree']['whups']['queues'][$id][$key] = false; - $perms['title']['whups:queues:' . $id . ':' . $key] = $val; - $perms['type']['whups:queues:' . $id . ':' . $key] = 'boolean'; - $perms['params']['whups:queues:' . $id . ':' . $key] = array(); + $perms['queues:' . $id . ':' . $key] = array( + 'title' => $val, + 'type' => 'boolean' + ); } } - $perms['tree']['whups']['replies'] = array(); - $perms['title']['whups:replies'] = _("Form Replies"); - /* Loop through type and replies and add their titles. */ foreach ($GLOBALS['whups_driver']->getAllTypes() as $type_id => $type_name) { foreach ($GLOBALS['whups_driver']->getReplies($type_id) as $reply_id => $reply) { - $perms['tree']['whups']['replies'][$reply_id] = false; - $perms['title']['whups:replies:' . $reply_id] = $type_name . ': ' . $reply['reply_name']; + $perms['replies:' . $reply_id] = array( + 'title' => $type_name . ': ' . $reply['reply_name'] + ); } } diff --git a/wicked/lib/Application.php b/wicked/lib/Application.php index 2a005a57f..03250f860 100644 --- a/wicked/lib/Application.php +++ b/wicked/lib/Application.php @@ -59,22 +59,26 @@ class Wicked_Application extends Horde_Registry_Application */ public function perms() { - $perms['tree']['wicked']['pages'] = array(); - $perms['title']['wicked:pages'] = _("Pages"); + $perms = array( + 'pages' => array( + 'title' => _("Pages") + ) + ); foreach (array('AllPages', 'LeastPopular', 'MostPopular', 'RecentChanges') as $val) { - $perms['tree']['wicked']['pages'][$val] = false; - $perms['title']['wicked:pages:' . $val] = $val; + $perms['pages:' . $val] = array( + 'title' => $val + ); } $pages = $GLOBALS['wicked']->getPages(); if (!($pages instanceof PEAR_Error)) { + sort($pages); foreach ($pages as $pagename) { - $pageId = $GLOBALS['wicked']->getPageId($pagename); - $perms['tree']['wicked']['pages'][$pageId] = false; - $perms['title']['wicked:pages:' . $pageId] = $pagename; + $perms['pages:' .$GLOBALS['wicked']->getPageId($pagename)] = array( + 'title' => $pagename + ); } - ksort($perms['tree']['wicked']['pages']); } return $perms; -- 2.11.0