Skip to content

Commit

Permalink
Update to OpenFGA 1.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kdubb committed Apr 2, 2024
1 parent 70ceb88 commit 450868d
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
public class DevServicesOpenFGAProcessor {

private static final Logger log = Logger.getLogger(DevServicesOpenFGAProcessor.class);
static final String OPEN_FGA_VERSION = "v1.4.3";
static final String OPEN_FGA_VERSION = "v1.5.1";
static final String OPEN_FGA_IMAGE = "openfga/openfga:" + OPEN_FGA_VERSION;
static final int OPEN_FGA_EXPOSED_HTTP_PORT = 8080;
static final int OPEN_FGA_EXPOSED_GRPC_PORT = 8081;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,66 @@
import javax.annotation.Nullable;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

public class Metadata {
@Nullable
Map<String, RelationMetadata> relations;
@Nullable
String module;
@JsonProperty("source_info")
@Nullable
String sourceInfo;

@JsonCreator
public Metadata(@Nullable Map<String, RelationMetadata> relations) {
public Metadata(@Nullable Map<String, RelationMetadata> relations, @Nullable String module, @Nullable String sourceInfo) {
this.relations = relations;
this.module = module;
this.sourceInfo = sourceInfo;
}

public Metadata(@Nullable Map<String, RelationMetadata> relations) {
this(relations, null, null);
}

@Nullable
public Map<String, RelationMetadata> getRelations() {
return relations;
}

@Nullable
public String getModule() {
return module;
}

@JsonProperty("source_info")
@Nullable
public String getSourceInfo() {
return sourceInfo;
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof Metadata))
return false;
Metadata metadata = (Metadata) o;
return Objects.equals(relations, metadata.relations);
return Objects.equals(relations, metadata.relations) && Objects.equals(module, metadata.module)
&& Objects.equals(sourceInfo, metadata.sourceInfo);
}

@Override
public int hashCode() {
return Objects.hash(relations);
return Objects.hash(relations, module, sourceInfo);
}

@Override
public String toString() {
return "Metadata{" +
"relations=" + relations +
"relations=" + relations + ", " +
"module=" + module + ", " +
"sourceInfo=" + sourceInfo +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,62 @@ public class RelationMetadata {
@JsonProperty("directly_related_user_types")
@Nullable
List<RelationReference> directlyRelatedUserTypes;
@Nullable
String module;
@JsonProperty("source_info")
@Nullable
String sourceInfo;

@JsonCreator
public RelationMetadata(@Nullable List<RelationReference> directlyRelatedUserTypes) {
public RelationMetadata(@Nullable List<RelationReference> directlyRelatedUserTypes, @Nullable String module,
@Nullable String sourceInfo) {
this.directlyRelatedUserTypes = directlyRelatedUserTypes;
this.module = module;
this.sourceInfo = sourceInfo;
}

public RelationMetadata(@Nullable List<RelationReference> directlyRelatedUserTypes) {
this(directlyRelatedUserTypes, null, null);
}

@Nullable
public List<RelationReference> getDirectlyRelatedUserTypes() {
return directlyRelatedUserTypes;
}

@Nullable
public String getModule() {
return module;
}

@JsonProperty("source_info")
@Nullable
public String getSourceInfo() {
return sourceInfo;
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof RelationMetadata))
return false;
RelationMetadata that = (RelationMetadata) o;
return Objects.equals(directlyRelatedUserTypes, that.directlyRelatedUserTypes);
return Objects.equals(directlyRelatedUserTypes, that.directlyRelatedUserTypes)
&& Objects.equals(module, that.module) && Objects.equals(sourceInfo, that.sourceInfo);
}

@Override
public int hashCode() {
return Objects.hash(directlyRelatedUserTypes);
return Objects.hash(directlyRelatedUserTypes, module, sourceInfo);
}

@Override
public String toString() {
return "RelationMetadata{" +
"directlyRelatedUserTypes=" + directlyRelatedUserTypes +
"directlyRelatedUserTypes=" + directlyRelatedUserTypes + ", " +
"module=" + module + ", " +
"sourceInfo=" + sourceInfo +
'}';
}
}

0 comments on commit 450868d

Please sign in to comment.