diff options
author | Russ Allbery <eagle@eyrie.org> | 2020-05-17 22:19:39 -0700 |
---|---|---|
committer | Russ Allbery <eagle@eyrie.org> | 2020-05-17 22:19:39 -0700 |
commit | 21651a03eee3a174c657515fc75ecd1857500c10 (patch) | |
tree | c3d78cf895f3f2e14d80e0153073aebfc5525357 | |
parent | 4338488b0410a87b553bfa7ae54b16837b108487 (diff) |
Sort the ACL membership report
In Wallet::Report, sort the results of acl_membership(). This is
only used for the duplicate ACLs report currently, but it may help
external callers as well as produce reliable results for testing.
Patch from macrotex.
-rw-r--r-- | perl/lib/Wallet/Report.pm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/perl/lib/Wallet/Report.pm b/perl/lib/Wallet/Report.pm index d4add04..a6aebb9 100644 --- a/perl/lib/Wallet/Report.pm +++ b/perl/lib/Wallet/Report.pm @@ -1,7 +1,7 @@ # Wallet::Report -- Wallet system reporting interface # # Written by Russ Allbery <eagle@eyrie.org> -# Copyright 2016 Russ Allbery <eagle@eyrie.org> +# Copyright 2016, 2020 Russ Allbery <eagle@eyrie.org> # Copyright 2008-2010, 2013-2014 # The Board of Trustees of the Leland Stanford Junior University # @@ -504,7 +504,8 @@ sub acls_unused { } # Obtain a textual representation of the membership of an ACL, returning undef -# on error and setting the internal error. +# on error and setting the internal error. Make sure the membership is sorted +# so that comparisons are possible. sub acl_membership { my ($self, $id) = @_; my $acl = eval { Wallet::ACL->new ($id, $self->{schema}) }; @@ -512,7 +513,9 @@ sub acl_membership { $self->error ($@); return; } - my @members = map { "$_->[0] $_->[1]" } $acl->list; + my @entries = $acl->list; + @entries = sort { $a->[0] cmp $b->[0] || $a->[1] cmp $b->[1] } $acl->list; + my @members = map { "$_->[0] $_->[1]" } @entries; if (!@members && $acl->error) { $self->error ($acl->error); return; |