diff options
author | Russ Allbery <rra@stanford.edu> | 2007-08-28 20:31:41 +0000 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2007-08-28 20:31:41 +0000 |
commit | b3b641a12fc0d0488c10df0046eccb3182c674d6 (patch) | |
tree | 5bfc4dd10b60a135e6f1208fd072e2b75beb45c8 /perl/Wallet/Object.pm | |
parent | 0a326e5dfdfc707c94d6c803dcb14a1e0bd9cccf (diff) |
Use the new ACL object interface to find the ID of an ACL rather than
assuming they're always numeric.
Diffstat (limited to 'perl/Wallet/Object.pm')
-rw-r--r-- | perl/Wallet/Object.pm | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/perl/Wallet/Object.pm b/perl/Wallet/Object.pm index c560887..c77319a 100644 --- a/perl/Wallet/Object.pm +++ b/perl/Wallet/Object.pm @@ -17,6 +17,7 @@ use strict; use vars qw($VERSION); use DBI; +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 @@ -220,18 +221,20 @@ sub owner { # Get or set an ACL on an object. Takes the type of ACL and, if setting, the # new ACL identifier. If setting it, trace information must also be provided. sub acl { - my ($self, $type, $acl, $user, $host, $time) = @_; + my ($self, $type, $id, $user, $host, $time) = @_; if ($type !~ /^(get|store|show|destroy|flags)\z/) { $self->{error} = "invalid ACL type $type"; return; } my $attr = "acl_$type"; - if ($acl) { - if ($acl !~ /^\d+\z/) { - $self->{error} = "malformed ACL id $acl"; - return; + if ($id) { + my $acl; + eval { $acl = Wallet::ACL->new ($id) }; + if ($@) { + $self->{error} = $@; + return undef; } - return $self->_set_internal ($attr, $acl, $user, $host, $time); + return $self->_set_internal ($attr, $acl->id, $user, $host, $time); } else { return $self->_get_internal ($attr); } |