TT#71871 - Fix /api/bannedusers arbitrary result

* Change condition that was defaulting to
	   one banned user in case of looking by
	   a non-existent id; it now returns empty
	   array which is causing the correct
	   'entity not found' error

Change-Id: Id3191ae78e7804fb62420bf15b292207c087234d
(cherry picked from commit 2d9d9a813c)
changes/33/36233/2
Flaviu Mates 6 years ago
parent 703a1cc468
commit 06c1927795

@ -80,7 +80,16 @@ EOF
}
my $config_failed_auth_attempts = $c->config->{security}->{failed_auth_attempts} // 3;
#in case we requested to filter by username, we will use it as the only possible key
for my $key ( ( defined $params{id} && exists $usr->{$params{id}}) ? ( $params{id} ) : (keys %{ $usr }) ) {
my @user_ids;
if (defined $params{id}) {
if (exists $usr->{$params{id}}) {
@user_ids = ($params{id});
}
}
else {
@user_ids = (keys %{ $usr });
}
for my $key (@user_ids) {
my $last_auth = $usr->{$key}->{last_auth} ? NGCP::Panel::Utils::DateTime::epoch_local($usr->{$key}->{last_auth}) : undef;
if ($last_auth) {
$last_auth->set_time_zone($c->session->{user_tz}) if $c->session->{user_tz};

Loading…
Cancel
Save