Skip to content

Commit cf53c70

Browse files
committed
Add condition example to JSONL tuples
1 parent 3db5535 commit cf53c70

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{"user": "user:anne", "relation": "owner", "object": "folder:product"}
22
{"user": "folder:product", "relation": "parent", "object": "folder:product-2021"}
33
{"user": "user:beth", "relation": "viewer", "object": "folder:product-2021"}
4+
{"user": "folder:product", "relation": "parent", "object": "folder:product-2021", "condition": {"name": "inOfficeIP", "context": {"ip_addr": "10.0.0.1"}}}

cmd/tuple/write_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,17 @@ func TestParseTuplesFileData(t *testing.T) {
167167
Relation: "viewer",
168168
Object: "folder:product-2021",
169169
},
170+
{
171+
User: "folder:product",
172+
Relation: "parent",
173+
Object: "folder:product-2021",
174+
Condition: &openfga.RelationshipCondition{
175+
Name: "inOfficeIP",
176+
Context: &map[string]interface{}{
177+
"ip_addr": "10.0.0.1",
178+
},
179+
},
180+
},
170181
},
171182
},
172183
{

0 commit comments

Comments
 (0)