fix: groupInfo: don't attempt to (and fail) display the guest list when account doesn't have access to it

This commit is contained in:
Stéphane Lesimple 2024-12-17 13:33:57 +00:00 committed by Stéphane Lesimple
parent a20a3b8a5d
commit 92d8b421c2

View file

@ -253,14 +253,15 @@ sub print_group_info {
if $ret{'members'};
# show guest info, along with the number of accesses each guest has
my @guest_text;
foreach my $guest (@{$ret{'guests'}}) {
my $nb = $ret{'guests_accesses'}{$guest};
push @guest_text, sprintf("%s[%s]", $guest, $nb // '?');
if ($ret{'guests'}) {
my @guest_text;
foreach my $guest (@{$ret{'guests'}}) {
my $nb = $ret{'guests_accesses'}{$guest};
push @guest_text, sprintf("%s[%s]", $guest, $nb // '?');
}
osh_info("Group ${groupName}'s Guests (with access to SOME of the group servers) are: "
. colored(@{$ret{'guests'}} ? join(" ", sort @guest_text) : '-', 'red'));
}
osh_info("Group ${groupName}'s Guests (with access to SOME of the group servers) are: "
. colored(@{$ret{'guests'}} ? join(" ", sort @guest_text) : '-', 'red'))
if $ret{'guests'};
# current user doesn't have enough rights to get this info, tell them that
if (!$ret{'members'}) {