lockedit can make sense with no auth plugins

On second though, you might want a wide-open wiki with some locked
pages that cannot be edited online.

So, the right thing for lockedit to do when there are no auth plugins is
to just say the page cannot be edited.
master
Joey Hess 2010-01-04 19:40:33 -05:00
parent 3e6331127b
commit 264f469894
2 changed files with 3 additions and 11 deletions

View File

@ -7,7 +7,6 @@ use IkiWiki 3.00;
sub import {
hook(type => "getsetup", id => "lockedit", call => \&getsetup);
hook(type => "checkconfig", id => "lockedit", call => \&checkconfig);
hook(type => "canedit", id => "lockedit", call => \&canedit);
}
@ -27,12 +26,6 @@ sub getsetup () {
},
}
sub checkconfig () {
if (! exists $IkiWiki::hooks{auth}) {
error gettext("lockedit plugin is enabled, but no authentication plugins are enabled");
}
}
sub canedit ($$) {
my $page=shift;
my $cgi=shift;
@ -46,8 +39,9 @@ sub canedit ($$) {
user => $session->param("name"),
ip => $ENV{REMOTE_ADDR},
)) {
if (! defined $user ||
! IkiWiki::userinfo_get($session->param("name"), "regdate")) {
if ((! defined $user ||
! IkiWiki::userinfo_get($session->param("name"), "regdate")) &&
exists $IkiWiki::hooks{auth}) {
return sub { IkiWiki::needsignin($cgi, $session) };
}
else {

2
debian/changelog vendored
View File

@ -4,8 +4,6 @@ ikiwiki (3.20100104) UNRELEASED; urgency=low
(Sjoerd)
* signinedit: Auto-disable the plugin when all authentication methods
are disabled.
* lockedit: Detect if no authentication plugins are enabled, and
die with an error message as this configuration does not make sense.
-- Joey Hess <joeyh@debian.org> Mon, 04 Jan 2010 12:53:24 -0500