diff options
-rw-r--r-- | IkiWiki/Plugin/passwordauth.pm | 11 | ||||
-rw-r--r-- | IkiWiki/Render.pm | 3 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/todo/Allow_disabling_edit_and_preferences_links.mdwn | 10 |
4 files changed, 22 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++; } diff --git a/debian/changelog b/debian/changelog index dd24e0bba..06bed479b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,6 +22,7 @@ ikiwiki (3.141) UNRELEASED; urgency=low is not available. Closes: #532285 * meta: Add openid delegate parameter to allow delegating only openid or openid2. + * Disable the Preferences link if no plugin with an auth hook is enabled. -- Joey Hess <joeyh@debian.org> Tue, 02 Jun 2009 17:03:41 -0400 diff --git a/doc/todo/Allow_disabling_edit_and_preferences_links.mdwn b/doc/todo/Allow_disabling_edit_and_preferences_links.mdwn index 5b9cc8742..4277ae899 100644 --- a/doc/todo/Allow_disabling_edit_and_preferences_links.mdwn +++ b/doc/todo/Allow_disabling_edit_and_preferences_links.mdwn @@ -67,3 +67,13 @@ Patch: >>> Adding a new `canlogin` hook looks like overkill to me. [[Joey]], how >>> about making registration of the `auth` hook mandatory for all plugins >>> making sense of the "Preferences" link? --[[Lunar]] + +>>>> Hmm, using the `auth` hook existance does seem like a nice solution. +>>>> While splitting the preferences code out into its own plugin is +>>>> easily enough done, it has the minor problem of being yet another +>>>> file nearly all ikiwikis will have to load, and also, prefs would +>>>> have to be disabled manually. So I like that using the hook would +>>>> cause it to auto-disable if nothing uses it. It's a bit ugly that +>>>> passwordauth doesn't need an auth hook (it could be reorged to +>>>> use it instead of formbuilder, maybe) and would probably just have an +>>>> empty one. Thanks for the idea. --[[Joey]] [[done]] |