Skip to content

Commit eafa90a

Browse files
committed
fix(rbac): drop permissions which the current version of the client does not know how to read
1 parent 2747bac commit eafa90a

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/main/java/io/weaviate/client6/v1/api/rbac/Permission.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ enum Kind implements JsonEnum<Kind> {
3636
GROUPS("groups"),
3737
ROLES("roles"),
3838
NODES("nodes"),
39+
NAMESPACES("namespaces"),
3940
TENANTS("tenants"),
4041
REPLICATE("replicate"),
4142
USERS("users"),

src/main/java/io/weaviate/client6/v1/api/rbac/Role.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.io.IOException;
44
import java.util.Arrays;
55
import java.util.List;
6+
import java.util.Objects;
67

78
import com.google.gson.Gson;
89
import com.google.gson.TypeAdapter;
@@ -43,6 +44,9 @@ public T read(JsonReader in) throws IOException {
4344
if (role.permissions == null) {
4445
return (T) role;
4546
}
47+
// Permissions which are not known to this client version
48+
// will be returned as null; we should drop them before merging.
49+
role.permissions.removeIf(Objects::isNull);
4650
return (T) new Role(role.name(), Permission.merge(role.permissions));
4751
}
4852
};

0 commit comments

Comments
 (0)