[dokuwiki] Re: Syntax Plugin: How to manipulate wiki content
- From: Christopher Smith <chris@xxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Wed, 10 Dec 2008 13:58:46 +0900
On 10 Dec 2008, at 04:47, James Lin wrote:
Hi Guys,
I am trying to write a custom ACL plugin to restrict access to
individual wiki pages, it works like this:
putting the tag {{restrict group=developers /restrict}} at the
beginning of the wiki page.
my problem is:
if the access is denied, I need to change the wiki page content to
display some friendly message. However I don't know how to modify
the content outside my syntax scope.
if I use $renderer->doc .= "access denied", it only replace my
syntax but not global content.
I know the builtin ACL does similar thing but I just don't know
which internal function to use. Please help.
Cheers
James Lin
My guess would be:
Handle your tag in metadata rather than html. Take a look at the
Dublin Core, http://dublincore.org, for possible standard terms
(dokuwiki metadata keys) that would be appropriate. "rights" and
"accessRights" are possibilities. By having the information in the
dokuwiki's page metadata it is easy for other code to check the
metadata value (see p_get_metadata() function in inc/parserutils.php).
Your ACL backend or an action plugin would then check the page's
metadata for the metadata keys and respond accordingly. If its an ACL
backend you'll get DokuWiki's standard restricted access message. If
its an action plugin, you'll need to review the event list (http://www.dokuwiki.org/devel:events_list
) to work out which event is most appropriate - possibly
TPL_ACT_RENDER. Handling this properly as a plugin would also mean
intervening in other dokuwiki actions where page links are hidden when
the user does not have read access (e.g. search) probably via the
SEARCH_QUERY_PAGELOOKUP event.
Cheers,
Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
Other related posts: