update account policy check before verifying policy status

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
bcmmbaga 2024-10-21 17:30:31 +03:00
parent ea6d037b17
commit 9b0424ea55
No known key found for this signature in database
GPG Key ID: 511EED5C928AD547

View File

@ -461,15 +461,14 @@ func (am *DefaultAccountManager) savePolicy(account *Account, policyToSave *Poli
}
oldPolicy := account.Policies[policyIdx]
// Update the existing policy
account.Policies[policyIdx] = policyToSave
if !policyToSave.Enabled && !oldPolicy.Enabled {
return false, nil
}
updateAccountPeers := anyGroupHasPeers(account, oldPolicy.ruleGroups()) || anyGroupHasPeers(account, policyToSave.ruleGroups())
// Update the existing policy
account.Policies[policyIdx] = policyToSave
return updateAccountPeers, nil
}