diff --git a/bundles/org.openhab.io.homekit/pom.xml b/bundles/org.openhab.io.homekit/pom.xml index 516609c66da4a..12a0c39fde3d5 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 941081150f147..57904c2737232 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; @@ -62,7 +63,7 @@ public void setBlockUserDeletion(boolean blockUserDeletion) { } @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); @@ -133,6 +134,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) {