diff options
| author | Russ Allbery <rra@stanford.edu> | 2007-09-17 16:02:18 +0000 | 
|---|---|---|
| committer | Russ Allbery <rra@stanford.edu> | 2007-09-17 16:02:18 +0000 | 
| commit | 81d2da8adbf8db6629e7a223b10633e58b288b19 (patch) | |
| tree | 9c061fe9dac79044f19217b9a7fdb29559468424 /perl/Wallet | |
| parent | a793a836222b551517e359b47ba0882b4910944d (diff) | |
In show() for an object, call show() for each of the ACLs on that object
and append that information to the object description.
Diffstat (limited to 'perl/Wallet')
| -rw-r--r-- | perl/Wallet/Object/Base.pm | 17 | 
1 files changed, 14 insertions, 3 deletions
| diff --git a/perl/Wallet/Object/Base.pm b/perl/Wallet/Object/Base.pm index 79662e7..cddc0bf 100644 --- a/perl/Wallet/Object/Base.pm +++ b/perl/Wallet/Object/Base.pm @@ -346,16 +346,25 @@ sub show {          return undef;      }      my $output = ''; +    my @acls;      for (my $i = 0; $i < @data; $i++) {          next unless defined $data[$i];          if ($attrs[$i][0] =~ /^ob_(owner|acl_)/) {              my $acl = eval { Wallet::ACL->new ($data[$i], $self->{dbh}) };              if ($acl and not $@) {                  $data[$i] = $acl->name || $data[$i]; +                push (@acls, [ $acl, $data[$i] ]);              }          }          $output .= sprintf ("%15s: %s\n", $attrs[$i][1], $data[$i]);      } +    if (@acls) { +        my %seen; +        @acls = grep { !$seen{$_->[1]}++ } @acls; +        for my $acl (@acls) { +            $output .= "\n" . $acl->[0]->show; +        } +    }      return $output;  } @@ -529,9 +538,11 @@ Returns a formatted text description of the object suitable for human  display, or undef on error.  The default implementation shows all of the  base metadata about the object, formatted as key: value pairs with the keys  aligned in the first 15 characters followed by a space, a colon, and the -value.  Object implementations with additional data to display can rely on -that format to add additional settings into the formatted output or at the -end with a matching format. +value.  If any ACLs or an owner are set, after this data there is a blank +line and then the information for each unique ACL, separated by blank lines. +Object implementations with additional data to display can rely on that +format to add additional settings into the formatted output or at the end +with a matching format.  =item store(DATA, PRINCIPAL, HOSTNAME [, DATETIME]) | 
