aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/lockedit.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-01-07 16:34:13 -0500
committerJoey Hess <joey@kodama.kitenet.net>2008-01-07 16:34:13 -0500
commitc487b847e2053b13c4eea0ccfeecf5a41c396412 (patch)
treec58c8a1dcc3372907fdc2e2940dcc3cc5faf4adf /IkiWiki/Plugin/lockedit.pm
parent45de8dc710bf5844ed99514342bade439c396084 (diff)
downloadikiwiki-c487b847e2053b13c4eea0ccfeecf5a41c396412.tar
ikiwiki-c487b847e2053b13c4eea0ccfeecf5a41c396412.tar.gz
* Improved the canedit hook interface, allowing a callback function to be
returned (and not run in some cases) rather than the plugins directly forcing a user to log in. * opendiscussion: allow editing of the toplevel discussion page, and, indirectly, allow creating new discussion pages.
Diffstat (limited to 'IkiWiki/Plugin/lockedit.pm')
-rw-r--r--IkiWiki/Plugin/lockedit.pm13
1 files changed, 9 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/lockedit.pm b/IkiWiki/Plugin/lockedit.pm
index a829df1cf..5a4e2fc38 100644
--- a/IkiWiki/Plugin/lockedit.pm
+++ b/IkiWiki/Plugin/lockedit.pm
@@ -21,10 +21,15 @@ sub canedit ($$) { #{{{
foreach my $admin (@{$config{adminuser}}) {
if (pagespec_match($page, IkiWiki::userinfo_get($admin, "locked_pages"))) {
- IkiWiki::needsignin($cgi, $session) unless defined $user;
- return sprintf(gettext("%s is locked by %s and cannot be edited"),
- htmllink("", "", $page, noimageinline => 1),
- IkiWiki::userlink($admin));
+ if (! defined $user ||
+ ! userinfo_get($session->param("name"), "regdate")) {
+ return sub { IkiWiki::needsignin($cgi, $session) };
+ }
+ else {
+ return sprintf(gettext("%s is locked by %s and cannot be edited"),
+ htmllink("", "", $page, noimageinline => 1),
+ IkiWiki::userlink($admin));
+ }
}
}