summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/Plugin/attachment.pm20
-rw-r--r--debian/changelog2
-rw-r--r--doc/ikiwiki/pagespec/attachment.mdwn4
3 files changed, 26 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm
index 999fa4a86..f1a9b1939 100644
--- a/IkiWiki/Plugin/attachment.pm
+++ b/IkiWiki/Plugin/attachment.pm
@@ -311,6 +311,26 @@ sub match_user ($$;@) { #{{{
}
} #}}}
+sub match_admin ($$;@) { #{{{
+ shift;
+ shift;
+ my %params=@_;
+
+ if (! exists $params{user}) {
+ return IkiWiki::FailReason->new("no user specified");
+ }
+
+ if (defined $params{user} && IkiWiki::is_admin($params{user})) {
+ return IkiWiki::SuccessReason->new("user is an admin");
+ }
+ elsif (! defined $params{user}) {
+ return IkiWiki::FailReason->new("not logged in");
+ }
+ else {
+ return IkiWiki::FailReason->new("user is not an admin");
+ }
+} #}}}
+
sub match_ip ($$;@) { #{{{
shift;
my $ip=shift;
diff --git a/debian/changelog b/debian/changelog
index ff119a314..002591083 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ ikiwiki (2.66) UNRELEASED; urgency=low
* recentchanges: Fix redirects to non-page files.
* aggregate: Avoid uninitialized value warnings for pages with no recorded
ctime.
+ * attachment: Add admin() pagespec to test if the uploading user is a wiki
+ admin.
-- Joey Hess <joeyh@debian.org> Thu, 25 Sep 2008 13:45:55 -0400
diff --git a/doc/ikiwiki/pagespec/attachment.mdwn b/doc/ikiwiki/pagespec/attachment.mdwn
index 6b86c510b..234fcdf02 100644
--- a/doc/ikiwiki/pagespec/attachment.mdwn
+++ b/doc/ikiwiki/pagespec/attachment.mdwn
@@ -41,6 +41,10 @@ additional tests:
Tests whether the attachment is being uploaded by a user with the
specified username. If openid is enabled, an openid can also be put here.
+* adminuser()
+
+ Tests whether the attachment is being uploded by one of the wiki admins.
+
* ip(address)
Tests whether the attacment is being uploaded from the specified IP