[#1524] tree: Make check APE error get wrapped to api status
All checks were successful
Tests and linters / Run gofumpt (push) Successful in 2m57s
Tests and linters / Staticcheck (push) Successful in 3m40s
Vulncheck / Vulncheck (push) Successful in 3m47s
Build / Build Components (push) Successful in 4m40s
Pre-commit hooks / Pre-commit (push) Successful in 4m51s
Tests and linters / gopls check (push) Successful in 5m3s
Tests and linters / Tests with -race (push) Successful in 5m52s
Tests and linters / Tests (push) Successful in 6m47s
Tests and linters / Lint (push) Successful in 6m49s
All checks were successful
Tests and linters / Run gofumpt (push) Successful in 2m57s
Tests and linters / Staticcheck (push) Successful in 3m40s
Vulncheck / Vulncheck (push) Successful in 3m47s
Build / Build Components (push) Successful in 4m40s
Pre-commit hooks / Pre-commit (push) Successful in 4m51s
Tests and linters / gopls check (push) Successful in 5m3s
Tests and linters / Tests with -race (push) Successful in 5m52s
Tests and linters / Tests (push) Successful in 6m47s
Tests and linters / Lint (push) Successful in 6m49s
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
bba1892fa1
commit
00c608c05e
1 changed files with 11 additions and 1 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
core "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
|
core "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
||||||
|
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/acl"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/acl"
|
||||||
cidSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cidSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto"
|
frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto"
|
||||||
|
@ -62,7 +63,16 @@ func (s *Service) verifyClient(ctx context.Context, req message, cid cidSDK.ID,
|
||||||
return fmt.Errorf("can't get request role: %w", err)
|
return fmt.Errorf("can't get request role: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return s.checkAPE(ctx, bt, cnr, cid, op, role, pubKey)
|
if err = s.checkAPE(ctx, bt, cnr, cid, op, role, pubKey); err != nil {
|
||||||
|
return apeErr(err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func apeErr(err error) error {
|
||||||
|
errAccessDenied := &apistatus.ObjectAccessDenied{}
|
||||||
|
errAccessDenied.WriteReason(err.Error())
|
||||||
|
return errAccessDenied
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true iff the operation is read-only and request was signed
|
// Returns true iff the operation is read-only and request was signed
|
||||||
|
|
Loading…
Reference in a new issue