Added my site, even though it's in an early state
[ikiwiki.git] / IkiWiki / Plugin / anonok.pm
blob0e74cbfadfbe71986ae2755b98d979cd3d00cb9b
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::anonok;
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
8 sub import {
9 hook(type => "getsetup", id => "anonok", call => \&getsetup);
10 hook(type => "canedit", id => "anonok", call => \&canedit);
13 sub getsetup () {
14 return
15 plugin => {
16 safe => 1,
17 rebuild => 0,
18 section => "auth",
20 anonok_pagespec => {
21 type => "pagespec",
22 example => "*/discussion",
23 description => "PageSpec to limit which pages anonymous users can edit",
24 link => "ikiwiki/PageSpec",
25 safe => 1,
26 rebuild => 0,
30 sub canedit ($$$) {
31 my $page=shift;
32 my $cgi=shift;
33 my $session=shift;
35 my $ret;
37 if (exists $config{anonok_pagespec} && length $config{anonok_pagespec}) {
38 if (pagespec_match($page, $config{anonok_pagespec},
39 location => $page)) {
40 return "";
42 else {
43 return undef;
46 else {
47 return "";