mirror of
https://github.com/ovh/the-bastion.git
synced 2024-09-20 15:05:58 +08:00
fix: cleanup-guest-key-access: use cache for performance
This commit is contained in:
parent
bdea34ccad
commit
7a3306a00d
|
@ -106,10 +106,10 @@ foreach my $shortGroup (sort keys %$groups) {
|
||||||
|
|
||||||
# the "members" of the system group key$shortGroup might be either members or guests,
|
# the "members" of the system group key$shortGroup might be either members or guests,
|
||||||
# so we first rule out members
|
# so we first rule out members
|
||||||
next if OVH::Bastion::is_group_member(account => $account, group => $shortGroup);
|
next if OVH::Bastion::is_group_member(account => $account, group => $shortGroup, cache => 1);
|
||||||
|
|
||||||
# it seems to be a guest, double-check that
|
# it seems to be a guest, double-check that
|
||||||
next if !OVH::Bastion::is_group_guest(account => $account, group => $shortGroup);
|
next if !OVH::Bastion::is_group_guest(account => $account, group => $shortGroup, cache => 1);
|
||||||
|
|
||||||
_log "<$shortGroup/$account> found a guest, checking remaining accesses..." if $verbose;
|
_log "<$shortGroup/$account> found a guest, checking remaining accesses..." if $verbose;
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ foreach my $shortGroup (sort keys %$groups) {
|
||||||
_log "<$shortGroup/$account> The account is a guest of group but has no remaining access, cleaning up...";
|
_log "<$shortGroup/$account> The account is a guest of group but has no remaining access, cleaning up...";
|
||||||
|
|
||||||
# get $group from $shortGroup
|
# get $group from $shortGroup
|
||||||
$fnret = OVH::Bastion::is_valid_group_and_existing(group => $shortGroup, groupType => 'key');
|
$fnret = OVH::Bastion::is_valid_group_and_existing(group => $shortGroup, groupType => 'key', cache => 1);
|
||||||
if (!$fnret) {
|
if (!$fnret) {
|
||||||
_warn "<$shortGroup/$account> Group seems invalid ($fnret), skipping";
|
_warn "<$shortGroup/$account> Group seems invalid ($fnret), skipping";
|
||||||
next;
|
next;
|
||||||
|
|
Loading…
Reference in a new issue