aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-06-09 15:39:00 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-06-09 15:39:00 -0400
commit48a5f9f2d8daef8c16b3e4b00511e00eaa0fa024 (patch)
tree08830250e168b2f8e11bd63951a9dabe34110476 /IkiWiki
parent1a880b7d7bcb8da5b1b07baf0fabecac3892b219 (diff)
downloadikiwiki-48a5f9f2d8daef8c16b3e4b00511e00eaa0fa024.tar
ikiwiki-48a5f9f2d8daef8c16b3e4b00511e00eaa0fa024.tar.gz
Disable the Preferences link if no plugin with an auth hook is enabled.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/passwordauth.pm11
-rw-r--r--IkiWiki/Render.pm3
2 files changed, 11 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/passwordauth.pm b/IkiWiki/Plugin/passwordauth.pm
index 90e2ca564..8cf5af51e 100644
--- a/IkiWiki/Plugin/passwordauth.pm
+++ b/IkiWiki/Plugin/passwordauth.pm
@@ -8,9 +8,10 @@ use IkiWiki 3.00;
sub import {
hook(type => "getsetup", id => "passwordauth", "call" => \&getsetup);
- hook(type => "formbuilder_setup", id => "passwordauth", call => \&formbuilder_setup);
- hook(type => "formbuilder", id => "passwordauth", call => \&formbuilder);
+ hook(type => "formbuilder_setup", id => "passwordauth", call => \&formbuilder_setup);
+ hook(type => "formbuilder", id => "passwordauth", call => \&formbuilder);
hook(type => "sessioncgi", id => "passwordauth", call => \&sessioncgi);
+ hook(type => "auth", id => "passwordauth", call => \&auth);
}
sub getsetup () {
@@ -337,4 +338,10 @@ sub sessioncgi ($$) {
}
}
+sub auth ($$) {
+ # While this hook is not currently used, it needs to exist
+ # so ikiwiki knows that the wiki supports logins, and will
+ # enable the Preferences page.
+}
+
1
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index f4de19378..2da18738d 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -65,7 +65,8 @@ sub genpage ($$) {
if (length $config{cgiurl}) {
$template->param(editurl => cgiurl(do => "edit", page => $page))
if IkiWiki->can("cgi_editpage");
- $template->param(prefsurl => cgiurl(do => "prefs"));
+ $template->param(prefsurl => cgiurl(do => "prefs"))
+ if exists $hooks{auth};
$actions++;
}