From 06d043e1eb748537d815c59dcb10d007851add7c Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 6 Jul 2022 16:32:53 +0300 Subject: [PATCH] [#553] Optimize target formation with multiple keys Signed-off-by: Alex Vanin --- 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 95bc1fdbc..ef7442e5d 100644 --- a/api/handler/acl.go +++ b/api/handler/acl.go @@ -800,15 +800,15 @@ func formRecords(operations []*astOperation, resource *astResource) ([]*eacl.Rec if astOp.IsGroupGrantee() { eacl.AddFormedTarget(record, eacl.RoleOthers) } else { - // TODO(av): optimize target + targetKeys := make([]ecdsa.PublicKey, 0, len(astOp.Users)) for _, user := range astOp.Users { pk, err := keys.NewPublicKeyFromString(user) if err != nil { return nil, fmt.Errorf("public key from string: %w", err) } - // Unknown role is used, because it is ignored when keys are set - eacl.AddFormedTarget(record, eacl.RoleUnknown, (ecdsa.PublicKey)(*pk)) + targetKeys = append(targetKeys, (ecdsa.PublicKey)(*pk)) } + eacl.AddFormedTarget(record, eacl.RoleUnknown, targetKeys...) } if len(resource.Object) != 0 { if len(resource.Version) != 0 {