Commit 8eb4db1e authored by Felipe Andrade's avatar Felipe Andrade Committed by Commit Bot

Change Kerberos accounts changes notifications

Kerberos credentials manager should notify observers exactly once when it
finishes adding a list of accounts. This CL removes the flag that was
blocking notifications in case of failure because, even in this cases,
managed accounts might have been added and observers should be notified.

Change-Id: Idf07f4f755cc5f81aa1788f28c416bfed0fec106
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1878251
Commit-Queue: Felipe Andrade <fsandrade@chromium.org>
Reviewed-by: default avatarLutz Justen <ljusten@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709435}
parent 4bd299ea
......@@ -467,17 +467,14 @@ void KerberosCredentialsManager::OnAddAccountRunnerDone(
SetActivePrincipalName(updated_principal);
else if (GetActivePrincipalName() == updated_principal)
GetKerberosFiles();
// Observers should be notified if at least one of the additions succeed.
should_notify_accounts_changes_ = true;
}
// Bring the merry news to the observers, but only if there is no outstanding
// query, so we don't spam observers.
if (add_account_runners_.empty() && should_notify_accounts_changes_) {
should_notify_accounts_changes_ = false;
// query, so we don't spam observers. We want to notify observers even if the
// additions result in error, because the account might actually have been
// added, in case of a managed account.
if (add_account_runners_.empty())
NotifyAccountsChanged();
}
std::move(callback).Run(error);
}
......
......@@ -257,9 +257,6 @@ class KerberosCredentialsManager : public policy::PolicyService::Observer {
// Keeps track of accounts currently being added.
std::vector<std::unique_ptr<KerberosAddAccountRunner>> add_account_runners_;
// Will be true if one of the current account additions succeed.
bool should_notify_accounts_changes_ = false;
// Variable expander for the principal name (replaces ${LOGIN_ID} etc.).
std::unique_ptr<VariableExpander> principal_expander_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment