Skip to content

Commit fee1032

Browse files
committed
memory relationship reader bug fixed
1 parent 48306ea commit fee1032

File tree

7 files changed

+44
-42
lines changed

7 files changed

+44
-42
lines changed

docs/v1/apidocs.swagger.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
"version": "v0.0.0-alpha9",
77
"contact": {
88
"name": "API Support",
9-
"url": "https://github.com/Permify/base/issues",
10-
"email": "hello@base.co"
9+
"url": "https://github.com/Permify/permify/issues",
10+
"email": "hello@permify.co"
1111
},
1212
"license": {
1313
"name": "GNU Affero General Public License v3.0",
14-
"url": "https://github.com/Permify/base/blob/master/LICENSE"
14+
"url": "https://github.com/Permify/permify/blob/master/LICENSE"
1515
}
1616
},
1717
"tags": [

internal/repositories/memory/relationshipReader.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ func (r *RelationshipReader) QueryRelationships(ctx context.Context, filter *bas
3737

3838
index, args := utils.GetIndexNameAndArgsByFilters(filter)
3939
var it memdb.ResultIterator
40+
4041
it, err = txn.Get(RelationTuplesTable, index, args...)
4142
if err != nil {
4243
return nil, errors.New(base.ErrorCode_ERROR_CODE_EXECUTION.String())
4344
}
4445

4546
fit := memdb.NewFilterIterator(it, utils.FilterQuery(filter))
46-
for obj := fit.Next(); obj != nil; obj = it.Next() {
47+
for obj := fit.Next(); obj != nil; obj = fit.Next() {
4748
t := obj.(repositories.RelationTuple)
4849
collection.Add(t.ToTuple())
4950
}

pkg/cmd/validate.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func validate() func(cmd *cobra.Command, args []string) error {
9595
Entity: q.Entity,
9696
Permission: q.Action,
9797
Subject: q.Subject,
98-
Depth: 20,
98+
Depth: 100,
9999
})
100100
if err != nil {
101101
return err
@@ -111,9 +111,9 @@ func validate() func(cmd *cobra.Command, args []string) error {
111111
} else {
112112
color.Danger.Printf("%v. %s ? => ", i+1, query)
113113
if res.Can == base.PermissionCheckResponse_RESULT_ALLOWED {
114-
color.Danger.Println("expected: ✗ ❌ , actual: ✅ ")
114+
color.Danger.Println("expected: ✗ ❌ , actual: ✅ ")
115115
} else {
116-
color.Danger.Println("expected: ✓ ✅ , actual: ❌ ")
116+
color.Danger.Println("expected: ✓ ✅ , actual: ❌ ")
117117
}
118118
color.Danger.Println("FAILED.")
119119
os.Exit(1)

pkg/dsl/ast/node.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func (sch *Schema) GetRelationReferenceIfExist(name string) ([]RelationTypeState
150150
// EntityStatement -
151151
type EntityStatement struct {
152152
Token token.Token // token.ENTITY
153-
Name token.Token // snapshot.IDENT
153+
Name token.Token // token.IDENT
154154
RelationStatements []Statement
155155
ActionStatements []Statement
156156
Option token.Token // token.OPTION
@@ -201,7 +201,7 @@ func (ls *EntityStatement) String() string {
201201
// RelationStatement -
202202
type RelationStatement struct {
203203
Token token.Token // token.RELATION
204-
Name token.Token // snapshot.IDENT
204+
Name token.Token // token.IDENT
205205
RelationTypes []Statement
206206
Option token.Token // token.OPTION
207207
}
@@ -240,8 +240,8 @@ func (ls *RelationStatement) String() string {
240240

241241
// RelationTypeStatement -
242242
type RelationTypeStatement struct {
243-
Sign token.Token // snapshot.sign
244-
Token token.Token // snapshot.IDENT
243+
Sign token.Token // token.SIGN
244+
Token token.Token // token.IDENT
245245
}
246246

247247
// statementNode -
@@ -270,11 +270,11 @@ func (ls *RelationTypeStatement) IsEntityReference() bool {
270270

271271
// Identifier -
272272
type Identifier struct {
273-
Token token.Token // snapshot.IDENT
273+
Token token.Token // token.IDENT
274274
Value string
275275
}
276276

277-
// statementNode -
277+
// expressionNode -
278278
func (ls *Identifier) expressionNode() {}
279279

280280
// TokenLiteral -
@@ -305,7 +305,7 @@ func (ls *Identifier) GetValue() string {
305305
// ActionStatement -
306306
type ActionStatement struct {
307307
Token token.Token // token.ACTION
308-
Name token.Token // snapshot.IDENT
308+
Name token.Token // token.IDENT
309309
ExpressionStatement Statement
310310
}
311311

@@ -351,7 +351,7 @@ func (es *ExpressionStatement) String() string {
351351

352352
// InfixExpression -
353353
type InfixExpression struct {
354-
Token token.Token // The operator snapshot, e.g. and, or
354+
Token token.Token // The operator token, e.g. and, or
355355
Left Expression
356356
Operator Operator
357357
Right Expression

pkg/dsl/parser/parser.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func (p *Parser) Parse() (*ast.Schema, error) {
170170
return schema, nil
171171
}
172172

173-
// parseStatement method based on defined snapshot types
173+
// parseStatement method based on defined token types
174174
func (p *Parser) parseStatement() (ast.Statement, error) {
175175
switch p.currentToken.Type {
176176
case token.ENTITY:
@@ -493,18 +493,18 @@ func (p *Parser) noInfixParseFnError(t token.Type) {
493493

494494
// illegal -
495495
func (p *Parser) illegal() {
496-
msg := fmt.Sprintf("%v:%v:illegal snapshot found", p.l.GetLinePosition(), p.l.GetColumnPosition())
496+
msg := fmt.Sprintf("%v:%v:illegal token found", p.l.GetLinePosition(), p.l.GetColumnPosition())
497497
p.errors = append(p.errors, msg)
498498
}
499499

500500
// peekError -
501501
func (p *Parser) peekError(t ...token.Type) {
502-
msg := fmt.Sprintf("%v:%v:expected next snapshot to be %s, got %s instead", p.l.GetLinePosition(), p.l.GetColumnPosition(), t, p.peekToken.Type)
502+
msg := fmt.Sprintf("%v:%v:expected next token to be %s, got %s instead", p.l.GetLinePosition(), p.l.GetColumnPosition(), t, p.peekToken.Type)
503503
p.errors = append(p.errors, msg)
504504
}
505505

506506
// currentError -
507507
func (p *Parser) currentError(t ...token.Type) {
508-
msg := fmt.Sprintf("%v:%v:expected snapshot to be %s, got %s instead", p.l.GetLinePosition(), p.l.GetColumnPosition(), t, p.currentToken.Type)
508+
msg := fmt.Sprintf("%v:%v:expected token to be %s, got %s instead", p.l.GetLinePosition(), p.l.GetColumnPosition(), t, p.currentToken.Type)
509509
p.errors = append(p.errors, msg)
510510
}

pkg/pb/base/v1/openapi.pb.go

+21-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/base/v1/openapi.proto

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
1212
version: "v0.0.0-alpha9";
1313
contact: {
1414
name: "API Support";
15-
url: "https://github.com/Permify/base/issues";
16-
email: "hello@base.co";
15+
url: "https://github.com/Permify/permify/issues";
16+
email: "hello@permify.co";
1717
};
1818
license: {
1919
name: "GNU Affero General Public License v3.0";
20-
url: "https://github.com/Permify/base/blob/master/LICENSE";
20+
url: "https://github.com/Permify/permify/blob/master/LICENSE";
2121
}
2222
};
2323
consumes: "application/json";

0 commit comments

Comments
 (0)