[#851] ape: Initialize and use policy contract interface

* Replace inmemory policy contract mock by initialized
  policy contract interface.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2023-12-13 15:46:31 +03:00 committed by Evgenii Stratonikov
parent 61da7dca24
commit 7d7cf05575
7 changed files with 22 additions and 7 deletions

View file

@ -70,7 +70,7 @@ import (
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version"
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/engine/inmemory"
policy_client "git.frostfs.info/TrueCloudLab/policy-engine/pkg/morph/policy"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
neogoutil "github.com/nspcc-dev/neo-go/pkg/util"
"github.com/panjf2000/ants/v2"
@ -623,6 +623,8 @@ type cfgLocalStorage struct {
}
type cfgAccessPolicyEngine struct {
policyContractHash neogoutil.Uint160
accessPolicyEngine *accessPolicyEngine
}
@ -1077,7 +1079,9 @@ func initAccessPolicyEngine(_ context.Context, c *cfg) {
)
}
morphRuleStorage := inmemory.NewInmemoryMorphRuleChainStorage()
morphRuleStorage := policy_client.NewContractStorage(
c.cfgMorph.client.GetActor(),
c.cfgObject.cfgAccessPolicyEngine.policyContractHash)
ape := newAccessPolicyEngine(morphRuleStorage, localOverrideDB)
c.cfgObject.cfgAccessPolicyEngine.accessPolicyEngine = ape