summaryrefslogtreecommitdiff
path: root/server/wallet-report
diff options
context:
space:
mode:
Diffstat (limited to 'server/wallet-report')
-rwxr-xr-xserver/wallet-report59
1 files changed, 55 insertions, 4 deletions
diff --git a/server/wallet-report b/server/wallet-report
index 435fb73..98fd07a 100755
--- a/server/wallet-report
+++ b/server/wallet-report
@@ -8,12 +8,31 @@
# See LICENSE for licensing terms.
##############################################################################
-# Declarations and site configuration
+# Declarations and globals
##############################################################################
use strict;
use Wallet::Report;
+# The help output, sent in reply to the help command. Lists each supported
+# report command with a brief description of what it does.
+our $HELP = <<'EOH';
+Wallet reporting help:
+ acls All ACLs
+ acls duplicate ACLs that duplicate another
+ acls empty All empty ACLs
+ acls entry <scheme> <id> ACLs containing this entry (wildcarded)
+ acls unused ACLs that are not referenced by any object
+ audit acls name ACLs failing the naming policy
+ audit objects name Objects failing the naming policy
+ objects All objects
+ objects acl <acl> Objects granting permissions to that ACL
+ objects flag <flag> Objects with that flag set
+ objects owner <owner> Objects owned by that owner
+ objects type <type> Objects of that type
+ objects unused Objects that have never been stored/gotten
+EOH
+
##############################################################################
# Implementation
##############################################################################
@@ -32,8 +51,14 @@ sub command {
if (!@acls and $report->error) {
die $report->error, "\n";
}
- for my $acl (sort { $$a[1] cmp $$b[1] } @acls) {
- print "$$acl[1] (ACL ID: $$acl[0])\n";
+ if (@args && $args[0] eq 'duplicate') {
+ for my $group (@acls) {
+ print join (' ', @$group), "\n";
+ }
+ } else {
+ for my $acl (sort { $$a[1] cmp $$b[1] } @acls) {
+ print "$$acl[1] (ACL ID: $$acl[0])\n";
+ }
}
} elsif ($command eq 'audit') {
die "too many arguments to audit\n" if @args > 2;
@@ -49,6 +74,8 @@ sub command {
print join (' ', @$item), "\n";
}
}
+ } elsif ($command eq 'help') {
+ print $HELP;
} elsif ($command eq 'objects') {
die "too many arguments to objects\n" if @args > 2;
my @objects = $report->objects (@args);
@@ -110,13 +137,16 @@ B<wallet-report> takes no traditional options.
=item acls
+=item acls duplicate
+
=item acls empty
=item acls entry <scheme> <identifier>
=item acls unused
-Returns a list of ACLs in the database. ACLs will be listed in the form:
+Returns a list of ACLs in the database. Except for the C<duplicate>
+report, ACLs will be listed in the form:
<name> (ACL ID: <id>)
@@ -124,6 +154,10 @@ where <name> is the human-readable name and <id> is the numeric ID. The
numeric ID is what's used internally by the wallet system. There will be
one line per ACL.
+For the C<duplicate> report, the output will instead be one duplicate set
+per line. This will be a set of ACLs that all have the same entries.
+Only the names will be given, separated by spaces.
+
If no search type is given, all the ACLs in the database will be returned.
If a search type (and possible search arguments) are given, then the ACLs
will be limited to those that match the search.
@@ -132,6 +166,12 @@ The currently supported ACL search types are:
=over 4
+=item acls duplicate
+
+Returns all sets of ACLs that are duplicates, meaning that they contain
+exactly the same entries. Each line will be the names of the ACLs in a
+set of duplicates, separated by spaces.
+
=item acls empty
Returns all ACLs which have no entries, generally so that abandoned ACLs
@@ -167,6 +207,10 @@ where <name> is the human-readable name and <id> is the numeric ID. The
numeric ID is what's used internally by the wallet system. There will be
one line per object or ACL.
+=item help
+
+Displays a summary of all available commands.
+
=item objects
=item objects acl <acl>
@@ -177,6 +221,8 @@ one line per object or ACL.
=item objects type <type>
+=item objects unused
+
Returns a list of objects in the database. Objects will be listed in the
form:
@@ -210,6 +256,11 @@ Returns all objects owned by the given ACL name or ID.
Returns all objects of the given type.
+=item objects unused
+
+Returns all objects that have never been downloaded (have never been the
+target of a get command).
+
=back
=item owners <type-pattern> <name-pattern>