]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/Allow_disabling_edit_and_preferences_links.mdwn
(no commit message)
[ikiwiki.git] / doc / todo / Allow_disabling_edit_and_preferences_links.mdwn
1 This patch allows disabling the edit and preferences link in the config file.  It is backwards compatible (so peoples edit and preferences links won't suddenly vanish).
2
3 To disable edit or prefs respectively, add the following to the config file:
4
5 <pre>
6   'edit' => 0,
7   'prefs' => 0, 
8 </pre>
9
10 Patch:
11 <pre>
12 --- /usr/share/perl5/IkiWiki/Render.pm.orig     2008-12-23 16:49:00.000000000 +1300
13 +++ /usr/share/perl5/IkiWiki/Render.pm  2008-12-23 16:55:40.000000000 +1300
14 @@ -80,8 +80,10 @@
15         my $actions=0;
16  
17         if (length $config{cgiurl}) {
18 -               $template->param(editurl => cgiurl(do => "edit", page => $page));
19 -               $template->param(prefsurl => cgiurl(do => "prefs"));
20 +               $template->param(editurl => cgiurl(do => "edit", page => $page))
21 +                       if ! defined $config{edit} || (defined $config{edit} && $config{edit} == 1);
22 +               $template->param(prefsurl => cgiurl(do => "prefs"))
23 +                       if ! defined $config{prefs} || (defined $config{prefs} && $config{prefs} == 1);
24                 $actions++;
25         }
26
27 </pre>
28
29 > On irc, you said, "That was to allow the hack to of using wikistatedir to
30 > allow me to generate two websites, one with inline editting, the other a
31 > static page for public consumption."
32
33 > The edit and preferences links can already be disabled by editing
34 > `page.tmpl`. (Look for PREFSURL and EDITURL).
35
36 > More to the point though, disabling those links does not disable anyone
37 > consticting the urls by hand and logging in and editing a page. So you'd
38 > really want to disable the editpage plugin in the setup file for the
39 > public, static wiki. Sounds like you might also want to turn off cgi
40 > entirely for that build. --[[Joey]] 
41
42 >> I want to retain the same page.tmpl for both sites (different templates
43 >> will just increase the maintenance hell), so disabling the links in the
44 >> config for one public site works better in my case.
45 >>
46 >> I do have the editpage plugin disabled for the public static wiki, but
47 >> the link still appears on the site.  I want to keep the cgi on, so that
48 >> the site is still searchable. --[[puck]]
49
50 >>> For me, disabling the editpage plugin does make the "Edit" link
51 >>> disappear (this is with 3.03) but as far as I can tell, "Preferences"
52 >>> is not controlled by any plugin.  It would be nice if it were; I am
53 >>> trying to achieve a configuration where the only action supported
54 >>> via CGI is blog-style comments.  --[Zack](http://zwol.livejournal.com/)
55
56 >>> Like [[puck]], I'd like to keep search available but I want to disable all
57 >>> login facitilities and thus disable the "Preferences" link.
58 >>>
59 >>> After digging a little bit in the source code, my first attempt was to make
60 >>> the "Preferences" link appear only if there is `sessioncgi` hooks
61 >>> registered.  But this will not work as the [[plugins/inline]] plugin also
62 >>> defines it.
63 >>>
64 >>> Looking for `auth` hooks currently would not work as at least
65 >>> [[plugins/passwordauth]] does not register one.
66 >>>
67 >>> Adding a new `canlogin` hook looks like overkill to me.  [[Joey]], how
68 >>> about making registration of the `auth` hook mandatory for all plugins
69 >>> making sense of the "Preferences" link? --[[Lunar]]
70
71 >>>> Hmm, using the `auth` hook existance does seem like a nice solution.
72 >>>> While splitting the preferences code out into its own plugin is
73 >>>> easily enough done, it has the minor problem of being yet another
74 >>>> file nearly all ikiwikis will have to load, and also, prefs would
75 >>>> have to be disabled manually. So I like that using the hook would
76 >>>> cause it to auto-disable if nothing uses it. It's a bit ugly that
77 >>>> passwordauth doesn't need an auth hook (it could be reorged to
78 >>>> use it instead of formbuilder, maybe) and would probably just have an
79 >>>> empty one. Thanks for the idea. --[[Joey]]  [[done]]
80
81 >>>>> Thanks for implementing it! --[[Lunar]]