aboutsummaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2007-10-10 21:54:40 +0000
committerRuss Allbery <rra@stanford.edu>2007-10-10 21:54:40 +0000
commit9183b6622eab6a27544af1c6ac1bfb3f1c4fb2e2 (patch)
tree85849404e3d251b45d3acbd3946e0c02d2a3bb07 /perl
parent3b240cd8b2ec081a1806a65c4ea1eb1271d1ddfb (diff)
Add the history method (for objects).
Diffstat (limited to 'perl')
-rw-r--r--perl/Wallet/Server.pm23
1 files changed, 22 insertions, 1 deletions
diff --git a/perl/Wallet/Server.pm b/perl/Wallet/Server.pm
index 172cdf1..2bc6ba1 100644
--- a/perl/Wallet/Server.pm
+++ b/perl/Wallet/Server.pm
@@ -24,7 +24,7 @@ use Wallet::Schema;
# This version should be increased on any code change to this module. Always
# use two digits for the minor version with a leading zero if necessary so
# that it will sort properly.
-$VERSION = '0.01';
+$VERSION = '0.02';
# This is a mapping of object types to class names, used to determine which
# object implementation should be instantiated for a given object type.
@@ -375,6 +375,19 @@ sub show {
return $result;
}
+# Return a human-readable description of the object history, or returns undef
+# and sets the internal error if the object can't be found or if the user
+# isn't authorized.
+sub history {
+ my ($self, $type, $name) = @_;
+ my $object = $self->retrieve ($type, $name);
+ return undef unless defined $object;
+ return undef unless $self->acl_check ($object, 'show');
+ my $result = $object->history;
+ $self->error ($object->error) unless defined $result;
+ return $result;
+}
+
# Destroys the object, or returns undef and sets the internal error if the
# object can't be found or if the user isn't authorized.
sub destroy {
@@ -801,6 +814,14 @@ special privileges to get objects.
Returns undef on failure. The caller should be careful to distinguish
between undef and the empty string, which is valid object data.
+=item history(TYPE, NAME)
+
+Returns (as a string) the human-readable history of the object identified by
+TYPE and NAME, or undef on error. To see the object history, the current
+user must be a member of the ADMIN ACL, authorized by the show ACL, or
+authorized by the owner ACL; however, if the show ACL is set, the owner ACL
+will not be checked.
+
=item owner(TYPE, NAME [, OWNER])
Gets or sets the owner for the object identified by TYPE and NAME. If OWNER