summaryrefslogtreecommitdiff
path: root/perl/lib/Wallet/Object/Base.pm
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2014-07-15 22:57:31 -0700
committerRuss Allbery <rra@stanford.edu>2014-07-15 22:58:47 -0700
commit5d0038202d82c71119fefa9c5bd0f816ae55991c (patch)
treeeabcd4396bfd1e41ca11eb0a107cf12609f8a414 /perl/lib/Wallet/Object/Base.pm
parentee79913831be70fc51c193ea4118a15abb038a67 (diff)
Return the name of the ACL instead of the numeric ID
The owner and getacl commands now return the current name of the ACL instead of its numeric ID, matching the documentation of owner. Change-Id: Ic47aad48bd1454ed4bffff7030b0492d74eee4fa Reviewed-on: https://gerrit.stanford.edu/1559 Reviewed-by: Russ Allbery <rra@stanford.edu> Tested-by: Russ Allbery <rra@stanford.edu>
Diffstat (limited to 'perl/lib/Wallet/Object/Base.pm')
-rw-r--r--perl/lib/Wallet/Object/Base.pm20
1 files changed, 17 insertions, 3 deletions
diff --git a/perl/lib/Wallet/Object/Base.pm b/perl/lib/Wallet/Object/Base.pm
index 4939bf5..a6a78bf 100644
--- a/perl/lib/Wallet/Object/Base.pm
+++ b/perl/lib/Wallet/Object/Base.pm
@@ -26,7 +26,7 @@ use Wallet::ACL;
# 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.07';
+$VERSION = '0.08';
##############################################################################
# Constructors
@@ -302,7 +302,14 @@ sub acl {
} elsif (defined $id) {
return $self->_set_internal ($attr, undef, $user, $host, $time);
} else {
- return $self->_get_internal ($attr);
+ my $id = $self->_get_internal ($attr);
+ return unless defined $id;
+ my $acl = eval { Wallet::ACL->new ($id, $self->{schema}) };
+ if ($@) {
+ $self->error ($@);
+ return;
+ }
+ return $acl->name;
}
}
@@ -380,7 +387,14 @@ sub owner {
} elsif (defined $owner) {
return $self->_set_internal ('owner', undef, $user, $host, $time);
} else {
- return $self->_get_internal ('owner');
+ my $id = $self->_get_internal ('owner');
+ return unless defined $id;
+ my $acl = eval { Wallet::ACL->new ($id, $self->{schema}) };
+ if ($@) {
+ $self->error ($@);
+ return;
+ }
+ return $acl->name;
}
}