From b1f758b12b198a51db719578649db9cc95172f3c Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Sat, 22 Oct 2011 02:11:58 +0200 Subject: check user acls. Depend cache on config-files --- action.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'action.php') diff --git a/action.php b/action.php index 1edea7b..e9b7158 100644 --- a/action.php +++ b/action.php @@ -64,13 +64,18 @@ class action_plugin_treenav extends DokuWiki_Action_Plugin { function hook_beforePage(&$event, $param) { global $ID; - $deps = p_get_metadata($id, 'treenav_deps', true); - $cache = new cache(cleanID($ID), 'plugin_treenav'); + global $INFO; + global $config_cascade; + $deps = p_get_metadata($id, 'treenav_deps', true); + $cache = new cache(cleanID($ID) . $INFO['userinfo']['name'], 'plugin_treenav'); + if (count($deps)>0 && $cache->useCache($deps)) { $doc = $cache->retrieveCache(false); } else { - $deps = array('files' => array()); + $deps = array('files' => array($config_cascade['acl']['default'])); + $deps['files'] = array_merge($deps['files'], getConfigFiles('main')); + $root = new treenav_NamespaceNode('',0); $renderer =& p_get_renderer('xhtml'); @@ -97,7 +102,8 @@ class action_plugin_treenav extends DokuWiki_Action_Plugin { global $ID; foreach ($node->getChildren() as $child) { foreach ($child->getPages() as $page) { - if (noNS($page['id']) === 'start') { + if (noNS($page['id']) === 'start' && + auth_quickaclcheck($page['id']) >= AUTH_READ) { $renderer->listitem_open(); $deps['files'][] = wikiFN($page['id']); // Add page file to dependencies $this->_renderPagelink($page['id'], $renderer); @@ -116,10 +122,12 @@ class action_plugin_treenav extends DokuWiki_Action_Plugin { foreach ($node->getPages() as $page) { if (noNS($page['id']) == 'start' && getNS($page['id']) != '') continue; - $renderer->listitem_open(); - $deps['files'][] = wikiFN($page['id']); // Add page file to dependencies - $this->_renderPagelink($page['id'], $renderer); - $renderer->listitem_close(); + if (auth_quickaclcheck($page['id']) >= AUTH_READ) { + $renderer->listitem_open(); + $deps['files'][] = wikiFN($page['id']); // Add page file to dependencies + $this->_renderPagelink($page['id'], $renderer); + $renderer->listitem_close(); + } } } -- cgit v1.2.1