2 package IkiWiki::Plugin::lockedit;
9 hook(type => "getsetup", id => "lockedit", call => \&getsetup);
10 hook(type => "canedit", id => "lockedit", call => \&canedit);
22 example => "!*/Discussion",
23 description => "PageSpec controlling which pages are locked",
24 link => "ikiwiki/PageSpec",
35 my $user=$session->param("name");
36 return undef if defined $user && IkiWiki::is_admin($user);
38 if (defined $config{locked_pages} && length $config{locked_pages} &&
39 pagespec_match($page, $config{locked_pages},
40 user => $session->param("name"),
41 ip => $ENV{REMOTE_ADDR},
43 if ((! defined $user ||
44 ! IkiWiki::userinfo_get($session->param("name"), "regdate")) &&
45 exists $IkiWiki::hooks{auth}) {
46 return sub { IkiWiki::needsignin($cgi, $session) };
49 return sprintf(gettext("%s is locked and cannot be edited"),
50 htmllink("", "", $page, noimageinline => 1));