[#510] treesvc: Rename tableFromBearer to useBearer
Some checks failed
ci/woodpecker/pr/pre-commit Pipeline failed
Build / Build Components (1.19) (pull_request) Successful in 3m56s
Build / Build Components (1.20) (pull_request) Successful in 3m40s
Tests and linters / Tests (1.20) (pull_request) Successful in 4m40s
Tests and linters / Tests with -race (pull_request) Successful in 4m57s
Tests and linters / Staticcheck (pull_request) Successful in 3m59s
Tests and linters / Tests (1.19) (pull_request) Successful in 14m5s
Tests and linters / Lint (pull_request) Successful in 14m52s

With impersonation, the old name is no longer descriptive.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-07-12 10:26:18 +03:00
parent aa935a4c40
commit 32d92b8038

View file

@ -84,7 +84,7 @@ func (s *Service) verifyClient(req message, cid cidSDK.ID, rawBearer []byte, op
return nil
}
var tableFromBearer bool
var useBearer bool
if len(rawBearer) != 0 {
if !basicACL.AllowedBearerRules(op) {
s.log.Debug(logs.TreeBearerPresentedButNotAllowedByACL,
@ -92,13 +92,13 @@ func (s *Service) verifyClient(req message, cid cidSDK.ID, rawBearer []byte, op
zap.String("op", op.String()),
)
} else {
tableFromBearer = true
useBearer = true
}
}
var tb eacl.Table
signer := req.GetSignature().GetKey()
if tableFromBearer && !bt.Impersonate() {
if useBearer && !bt.Impersonate() {
if !bearer.ResolveIssuer(*bt).Equals(cnr.Value.Owner()) {
return eACLErr(eaclOp, errBearerWrongOwner)
}
@ -110,7 +110,7 @@ func (s *Service) verifyClient(req message, cid cidSDK.ID, rawBearer []byte, op
}
tb = *tbCore.Value
if tableFromBearer && bt.Impersonate() {
if useBearer && bt.Impersonate() {
signer = bt.SigningKeyBytes()
}
}