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 ++++++++++++++++-------- plugin.info.txt | 3 +-- 2 files changed, 17 insertions(+), 10 deletions(-) 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(); + } } } diff --git a/plugin.info.txt b/plugin.info.txt index bde3922..3c9f2b4 100644 --- a/plugin.info.txt +++ b/plugin.info.txt @@ -3,5 +3,4 @@ author Yves Fischer email yvesf-git@xapek.org date 2011-01-01 name Simple tree navigation -desc Simple tree Navigation -url http://www.example.com +desc Simple tree navigation. Shows a tree-style Navigator. This plugin cannot display nested-accessible namespaces within non-accessible namespaces. -- cgit v1.2.1