Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[homekit] Update AuthInfo objects when blockUserDeletion changes #14017

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public HomekitAuthInfoImpl(Storage<Object> storage, String pin, String setupId,
initializeStorage();
}

public void setBlockUserDeletion(boolean blockUserDeletion) {
this.blockUserDeletion = blockUserDeletion;
}

@Override
public void createUser(String username, byte[] publicKey) {
logger.trace("create user {}", username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ protected synchronized void modified(Map<String, Object> config) {
for (HomekitChangeListener changeListener : changeListeners) {
changeListener.updateSettings(settings);
}
if (settings.blockUserDeletion != oldSettings.blockUserDeletion) {
for (HomekitAuthInfoImpl authInfo : authInfos) {
authInfo.setBlockUserDeletion(settings.blockUserDeletion);
}
}
}
} catch (IOException | InvalidAlgorithmParameterException e) {
logger.warn("could not initialize HomeKit bridge: {}", e.getMessage());
Expand Down Expand Up @@ -203,10 +208,6 @@ private HomekitRoot startBridge(HomekitServer homekitServer, HomekitAuthInfoImpl
changeListener.setBridge(bridge);
bridges.add(bridge);
bridge.setConfigurationIndex(changeListener.getConfigurationRevision());
bridge.refreshAuthInfo();

final int lastAccessoryCount = changeListener.getLastAccessoryCount();
int currentAccessoryCount = changeListener.getAccessories().size();
bridge.start();
return bridge;
}
Expand Down