my $user=shift;
my %params=@_;
- my $regexp=IkiWiki::glob2re($user);
-
if (! exists $params{user}) {
return IkiWiki::ErrorReason->new("no user specified");
}
+ my $regexp=IkiWiki::glob2re($user);
+
if (defined $params{user} && $params{user}=~$regexp) {
return IkiWiki::SuccessReason->new("user is $user");
}
if (! exists $params{ip}) {
return IkiWiki::ErrorReason->new("no IP specified");
}
+
+ my $regexp=IkiWiki::glob2re(lc $ip);
- if (defined $params{ip} && lc $params{ip} eq lc $ip) {
+ if (defined $params{ip} && lc $params{ip}=~$regexp) {
return IkiWiki::SuccessReason->new("IP is $ip");
}
else {
(smcv)
* openid: Automatically upgrade openid_realm to https when
accessed via https.
+ * The ip() pagespec can now contain glob characters to match eg, a subnet
+ full of spammers.
-- Joey Hess <joeyh@debian.org> Sun, 23 Jun 2013 14:02:01 -0400
* "`admin()`" - tests whether a modification is being made by one of the
wiki admins.
* "`ip(address)`" - tests whether a modification is being made from the
- specified IP address.
+ specified IP address. Glob patterns can be used in the address. For
+ example, `ip(127.0.0.*)`
* "`comment(glob)`" - matches comments to a page matching the glob.
* "`comment_pending(glob)`" - matches unmoderated, pending comments.
* "`postcomment(glob)`" - matches only when comments are being