aboutsummaryrefslogtreecommitdiff
path: root/perl/lib/Wallet/Report.pm
diff options
context:
space:
mode:
authorJon Robertson <jonrober@stanford.edu>2015-02-17 14:32:59 -0800
committerJon Robertson <jonrober@stanford.edu>2015-06-08 15:24:34 -0700
commit1575e25c9e9edc8d577a0f1118732c98871984e0 (patch)
tree3adaaba7c8da2d374b5e04c9ac73ab54c4aa66b6 /perl/lib/Wallet/Report.pm
parented628d6c89d63fdcbf038ce19776e3047c1105e2 (diff)
Added reports to list all types and acl schemes
Two new reports, 'types' and 'schemes'. These will print out all configured types and acl schemes. Change-Id: Ib06d37755fe80c168a6f723c9a1e683fdf5dfcde
Diffstat (limited to 'perl/lib/Wallet/Report.pm')
-rw-r--r--perl/lib/Wallet/Report.pm38
1 files changed, 38 insertions, 0 deletions
diff --git a/perl/lib/Wallet/Report.pm b/perl/lib/Wallet/Report.pm
index 912bc17..4d92d64 100644
--- a/perl/lib/Wallet/Report.pm
+++ b/perl/lib/Wallet/Report.pm
@@ -285,6 +285,27 @@ sub objects_history {
}
##############################################################################
+# Type reports
+##############################################################################
+
+# Return an alphabetical list of all valid types set up, along with the class
+# that they belong to.
+sub types {
+ my ($self) = @_;
+
+ my (@types);
+ my @types_rs = $self->{schema}->resultset('Type')->all;
+ for my $type_rs (@types_rs) {
+ my $name = $type_rs->ty_name;
+ my $class = $type_rs->ty_class;
+ push(@types, [ $name, $class ]);
+ }
+
+ @types = sort { $a->[0] cmp $b->[0] } @types;
+ return @types;
+}
+
+##############################################################################
# ACL reports
##############################################################################
@@ -527,6 +548,23 @@ sub owners {
return @owners;
}
+# Return an alphabetical list of all valid types set up, along with the class
+# that they belong to.
+sub acl_schemes {
+ my ($self) = @_;
+
+ my (@schemes);
+ my @acls_rs = $self->{schema}->resultset('AclScheme')->all;
+ for my $acl_rs (@acls_rs) {
+ my $name = $acl_rs->as_name;
+ my $class = $acl_rs->as_class;
+ push(@schemes, [ $name, $class ]);
+ }
+
+ @schemes = sort { $a->[0] cmp $b->[0] } @schemes;
+ return @schemes;
+}
+
##############################################################################
# Auditing
##############################################################################