diff --git a/bundles/org.openhab.io.homekit/pom.xml b/bundles/org.openhab.io.homekit/pom.xml index b4f859fbd866b..be9f816c5845c 100644 --- a/bundles/org.openhab.io.homekit/pom.xml +++ b/bundles/org.openhab.io.homekit/pom.xml @@ -22,7 +22,7 @@ io.github.hap-java hap - 2.0.4 + 2.0.5 compile diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitAuthInfoImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitAuthInfoImpl.java index ba538f8a7cc47..2f73d1ad092d9 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitAuthInfoImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitAuthInfoImpl.java @@ -17,6 +17,7 @@ import java.util.Base64; import java.util.Collection; import java.util.HashSet; +import java.util.stream.Collectors; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.storage.Storage; @@ -58,7 +59,7 @@ public HomekitAuthInfoImpl(Storage storage, String pin, String setupId, } @Override - public void createUser(String username, byte[] publicKey) { + public void createUser(String username, byte[] publicKey, boolean isAdmin) { logger.trace("create user {}", username); final String userKey = createUserKey(username); final String encodedPublicKey = Base64.getEncoder().encodeToString(publicKey); @@ -129,6 +130,18 @@ public boolean hasUser() { return keys.stream().anyMatch(this::isUserKey); } + @Override + public Collection listUsers() { + Collection keys = storage.getKeys(); + // don't forget to strip user_ prefix + return keys.stream().filter(this::isUserKey).map(u -> u.substring(5)).collect(Collectors.toList()); + } + + @Override + public boolean userIsAdmin(String username) { + return true; + } + public void clear() { logger.trace("clear all users"); if (!this.blockUserDeletion) {