From b144e50f7f1ece70026ec71e5725203d12c6a0ce Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Mon, 11 Jul 2022 00:24:02 +0400 Subject: [PATCH] [#584] Refactor formRecords func Signed-off-by: Angira Kekteeva --- api/handler/acl.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/handler/acl.go b/api/handler/acl.go index dca006c8c..6aa3dcfb0 100644 --- a/api/handler/acl.go +++ b/api/handler/acl.go @@ -784,7 +784,7 @@ func astToTable(ast *ast) (*eacl.Table, error) { table := eacl.NewTable() for i := len(ast.Resources) - 1; i >= 0; i-- { - records, err := formRecords(ast.Resources[i].Operations, ast.Resources[i]) + records, err := formRecords(ast.Resources[i]) if err != nil { return nil, fmt.Errorf("form records: %w", err) } @@ -796,10 +796,10 @@ func astToTable(ast *ast) (*eacl.Table, error) { return table, nil } -func formRecords(operations []*astOperation, resource *astResource) ([]*eacl.Record, error) { +func formRecords(resource *astResource) ([]*eacl.Record, error) { var res []*eacl.Record - for _, astOp := range operations { + for _, astOp := range resource.Operations { record := eacl.NewRecord() record.SetOperation(astOp.Op) record.SetAction(astOp.Action)