forked from TrueCloudLab/frostfs-s3-gw
[#584] Refactor formRecords func
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
parent
3f4a55f39e
commit
b144e50f7f
1 changed files with 3 additions and 3 deletions
|
@ -784,7 +784,7 @@ func astToTable(ast *ast) (*eacl.Table, error) {
|
||||||
table := eacl.NewTable()
|
table := eacl.NewTable()
|
||||||
|
|
||||||
for i := len(ast.Resources) - 1; i >= 0; i-- {
|
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 {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("form records: %w", err)
|
return nil, fmt.Errorf("form records: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -796,10 +796,10 @@ func astToTable(ast *ast) (*eacl.Table, error) {
|
||||||
return table, nil
|
return table, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func formRecords(operations []*astOperation, resource *astResource) ([]*eacl.Record, error) {
|
func formRecords(resource *astResource) ([]*eacl.Record, error) {
|
||||||
var res []*eacl.Record
|
var res []*eacl.Record
|
||||||
|
|
||||||
for _, astOp := range operations {
|
for _, astOp := range resource.Operations {
|
||||||
record := eacl.NewRecord()
|
record := eacl.NewRecord()
|
||||||
record.SetOperation(astOp.Op)
|
record.SetOperation(astOp.Op)
|
||||||
record.SetAction(astOp.Action)
|
record.SetAction(astOp.Action)
|
||||||
|
|
Loading…
Reference in a new issue