From 6f852e88e30775cb2238f301bb7ca1c4a83d59f4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 1 May 2008 14:58:23 -0400 Subject: [PATCH] anonk: Add anonok_pagespec configuration setting that can be used to allow anonymous users to edit only matching pages. Closes: #478892 --- IkiWiki/Plugin/anonok.pm | 19 ++++++++++++++++++- debian/changelog | 2 ++ doc/ikiwiki.setup | 4 ++++ doc/plugins/anonok.mdwn | 6 +++++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/anonok.pm b/IkiWiki/Plugin/anonok.pm index cd05cd865..ba02325ff 100644 --- a/IkiWiki/Plugin/anonok.pm +++ b/IkiWiki/Plugin/anonok.pm @@ -10,7 +10,24 @@ sub import { #{{{ } # }}} sub canedit ($$$) { #{{{ - return ""; + my $page=shift; + my $cgi=shift; + my $session=shift; + + my $ret; + + if (length $config{anonok_pagespec}) { + if (pagespec_match($page, $config{anonok_pagespec}, + location => $page)) { + return ""; + } + else { + return undef; + } + } + else { + return ""; + } } #}}} 1 diff --git a/debian/changelog b/debian/changelog index b7daeec27..1d06b4f5d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ ikiwiki (2.45) UNRELEASED; urgency=low * Add missing de.po. Closes: #471540 * img: Support a title attribute, will be passed through to html. Closes: #478718 + * anonk: Add anonok_pagespec configuration setting that can be used to + allow anonymous users to edit only matching pages. Closes: #478892 -- Joey Hess Sat, 26 Apr 2008 15:09:36 -0400 diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup index 885f77813..cbc4cbc9f 100644 --- a/doc/ikiwiki.setup +++ b/doc/ikiwiki.setup @@ -159,4 +159,8 @@ use IkiWiki::Setup::Standard { # mirror1 => "http://hostname1", # mirror2 => "http://hostname2/mirror", #}, + + # For use with the anonok plugin, a PageSpec specifying what + # pages anonymous users can edit + #anonok_pagespec => "*", } diff --git a/doc/plugins/anonok.mdwn b/doc/plugins/anonok.mdwn index 8afcf86f5..2afde29b3 100644 --- a/doc/plugins/anonok.mdwn +++ b/doc/plugins/anonok.mdwn @@ -2,4 +2,8 @@ [[tag type/auth]] By default, anonymous users cannot edit the wiki. This plugin allows -anonymous web users, who have not signed in, to edit any page in the wiki. +anonymous web users, who have not signed in, to edit any page in the wiki +by default. + +The plugin also has a configuration setting, `anonok_pagespec`. This +[[PageSpec]] can be used to allow anonymous editing of matching pages. -- 2.26.2