add paths to plugin files in copyright
[ikiwiki.git] / IkiWiki / Plugin / signinedit.pm
blob31160c02ffb581ad28da533e42737db8761295fe
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::signinedit;
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
8 sub import {
9 hook(type => "getsetup", id => "signinedit", call => \&getsetup);
10 hook(type => "canedit", id => "signinedit", call => \&canedit,
11 last => 1);
14 sub getsetup () {
15 return
16 plugin => {
17 safe => 1,
18 rebuild => 0,
19 section => "auth",
23 sub canedit ($$$) {
24 my $page=shift;
25 my $cgi=shift;
26 my $session=shift;
28 # Have the user sign in, if they are not already. This is why the
29 # hook runs last, so that any hooks that don't need the user to
30 # signin can override this.
31 if (! defined $session->param("name") ||
32 ! IkiWiki::userinfo_get($session->param("name"), "regdate")) {
33 return "" unless exists $IkiWiki::hooks{auth};
34 return sub { IkiWiki::needsignin($cgi, $session) };
36 else {
37 return "";