]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/signinedit.pm
standardising and documenting getsetup
[git.ikiwiki.info.git] / IkiWiki / Plugin / signinedit.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::signinedit;
4 use warnings;
5 use strict;
6 use IkiWiki 2.00;
8 sub import { #{{{
9         hook(type => "canedit", id => "signinedit", call => \&canedit,
10              last => 1);
11 } # }}}
13 sub canedit ($$$) { #{{{
14         my $page=shift;
15         my $cgi=shift;
16         my $session=shift;
18         # Have the user sign in, if they are not already. This is why the
19         # hook runs last, so that any hooks that don't need the user to
20         # signin can override this.
21         if (! defined $session->param("name") ||
22             ! IkiWiki::userinfo_get($session->param("name"), "regdate")) {
23                 return sub { IkiWiki::needsignin($cgi, $session) };
24         }
25         else {
26                 return "";
27         }
28 } #}}}
30 1