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