aclinfo plugin by Andreas Gohr
Shows who has which permissions for the current page.
Last updated on 2008-12-26. Provides Syntax.
Compatible with DokuWiki 2008-05-05.
Similar to permissioninfo.
This plugin displays all users and groups that are set up in ACLs and are affecting the current page. Effectively the plugin gives you a hint who can do what on the current page. It is written with sidebar templates in mind and will always show the permissions of the main page not of the sidebar page.
When used in a sidebar, you need to use the ~~NOCACHE~~ macro to make this plugin work correctly.
Download and install the plugin using the Plugin Manager using the following URL. Refer to Plugins on how to install plugins manually.
Simply put the following code into your page (e.g. your sidebar page):
~~ACLINFO~~
<?php $lang['perm0'] = '%s ne peut pas lire cette page'; $lang['perm1'] = '%s peut lire cette page'; $lang['perm2'] = '%s peut éditer cette page'; $lang['perm4'] = '%s peut créer une page'; $lang['perm8'] = '%s peut charger un fichier'; $lang['perm16'] = '%s peut effacer cette page';
Using the following ACL configuration you may get wrong ACL infos.
* @ALL 0 ns1:* @ns1reader 1 ns1:* @ns1writer 16
Using ~~ACLINFO~~ on the page ns1:index is fine …
… while using it on the page ns1:ns2:index you get …
… which is wrong, or at least not totaly correct. – tscherter [at] karmin [dot] ch
I thought this plugin could be useful to also allow checking rights on any specified page of the wiki. The following patch works for me.
diff -r bcb21bfb1e5a syntax.php --- a/syntax.php Tue Dec 22 08:08:41 2009 +0100 +++ b/syntax.php Tue Dec 22 09:53:25 2009 +0100 @@ -22,9 +22,9 @@ class syntax_plugin_aclinfo extends Doku return array( 'author' => 'Andreas Gohr', 'email' => 'gohr@cosmocode.de', - 'date' => '2008-12-26', + 'date' => '2009-12-22', 'name' => 'ACL Info Plugin', - 'desc' => 'Displays information about the ACLs for the current page', + 'desc' => 'Displays information about the ACLs for a page', 'url' => 'http://dokuwiki.org/plugin:aclinfo', ); } @@ -55,7 +55,7 @@ class syntax_plugin_aclinfo extends Doku * Connect pattern to lexer */ function connectTo($mode) { - $this->Lexer->addSpecialPattern('~~ACLINFO~~',$mode,'plugin_aclinfo'); + $this->Lexer->addSpecialPattern('~~ACLINFO!?[:0-9a-zA-Z]*?~~',$mode,'plugin_aclinfo'); } @@ -63,7 +63,8 @@ class syntax_plugin_aclinfo extends Doku * Handle the match */ function handle($match, $state, $pos, &$handler){ - return array(); + $match = substr($match,10,-2); + return array($match); } /** @@ -73,7 +74,13 @@ class syntax_plugin_aclinfo extends Doku global $INFO; if($format != 'xhtml') return false; - $perms = $this->_aclcheck($INFO['id']); + if(!$data[0]) { + $page = $INFO['id']; + } else { + $page = $data[0]; + } + + $perms = $this->_aclcheck($page); $R->listu_open(); foreach((array)$perms as $who => $p){ $R->listitem_open(1); @@ -90,7 +97,7 @@ class syntax_plugin_aclinfo extends Doku global $conf; global $AUTH_ACL; - + $id = preg_replace('/^:/','',$id); $ns = getNS($id); $perms = array();
Use it this way:
~~ACLINFO!path:to:a:page~~
and of course, the original syntax (without !path) works too.