aboutsummaryrefslogtreecommitdiff
path: root/perl/lib/Wallet/ACL.pm
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2014-07-15 20:33:18 -0700
committerRuss Allbery <rra@stanford.edu>2014-07-15 21:10:47 -0700
commit443c2c7ac38672f18a14a84e7a220d1a3b1cd545 (patch)
treee8144e552121846c9d7f555ba225a069fdbf104d /perl/lib/Wallet/ACL.pm
parentb1bd88daea1dde6de9e6a8688c6190cdc0b5c617 (diff)
Record ACL names in the ACL history
Change-Id: I0d7a088bb34dda2fc554b9f104c2a33e5faf879e Reviewed-on: https://gerrit.stanford.edu/1554 Reviewed-by: Russ Allbery <rra@stanford.edu> Tested-by: Russ Allbery <rra@stanford.edu>
Diffstat (limited to 'perl/lib/Wallet/ACL.pm')
-rw-r--r--perl/lib/Wallet/ACL.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/perl/lib/Wallet/ACL.pm b/perl/lib/Wallet/ACL.pm
index 6f5172a..b488b43 100644
--- a/perl/lib/Wallet/ACL.pm
+++ b/perl/lib/Wallet/ACL.pm
@@ -161,7 +161,7 @@ sub scheme_mapping {
# change and should be committed with that change.
sub log_acl {
my ($self, $action, $scheme, $identifier, $user, $host, $time) = @_;
- unless ($action =~ /^(add|remove)\z/) {
+ unless ($action =~ /^(add|remove|rename)\z/) {
die "invalid history action $action";
}
my $date = DateTime->from_epoch (epoch => $time);
@@ -184,7 +184,8 @@ sub log_acl {
# logged since it isn't a change to any of the data stored in the wallet.
# Returns true on success, false on failure.
sub rename {
- my ($self, $name) = @_;
+ my ($self, $name, $user, $host, $time) = @_;
+ $time ||= time;
if ($name =~ /^\d+\z/) {
$self->error ("ACL name may not be all numbers");
return;
@@ -195,6 +196,7 @@ sub rename {
my $acls = $self->{schema}->resultset('Acl')->find (\%search);
$acls->ac_name ($name);
$acls->update;
+ $self->log_acl ('rename', undef, undef, $user, $host, $time);
$guard->commit;
};
if ($@) {
@@ -381,6 +383,8 @@ sub history {
if ($data->ah_action eq 'add' || $data->ah_action eq 'remove') {
$output .= sprintf ("%s %s %s", $data->ah_action,
$data->ah_scheme, $data->ah_identifier);
+ } elsif ($data->ah_action eq 'rename') {
+ $output .= 'rename from ' . $data->ah_name;
} else {
$output .= $data->ah_action;
}