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