diff --git a/internal/lifecycle/fetcher.go b/internal/lifecycle/fetcher.go index 8b70183..44e28b8 100644 --- a/internal/lifecycle/fetcher.go +++ b/internal/lifecycle/fetcher.go @@ -4,7 +4,6 @@ import ( "context" "crypto/ecdsa" "encoding/binary" - "encoding/hex" "encoding/xml" "fmt" "io" @@ -23,7 +22,6 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" "git.frostfs.info/TrueCloudLab/hrw" "git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain" - "git.frostfs.info/TrueCloudLab/policy-engine/schema/native" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neo-go/pkg/util" @@ -217,7 +215,7 @@ func (p *JobProvider) handleUser(ctx context.Context, userHash util.Uint160, epo successfullyFetchedContainers := len(containers) - allowedChainRaw := formAllowedAPEChain(userKey.PublicKey()).Bytes() + allowedChainRaw := p.formAllowedAPEChain().Bytes() for _, container := range containers { uc := &UserContainer{ ID: userID, @@ -354,19 +352,13 @@ func (p *JobProvider) fetchLifecycleConfiguration(ctx context.Context, addr oid. return lifecycleCfg, nil } -func formAllowedAPEChain(userKey *keys.PublicKey) *chain.Chain { +func (p *JobProvider) formAllowedAPEChain() *chain.Chain { return &chain.Chain{ - ID: chain.ID("lifecycler"), + ID: chain.ID("lifecycler/" + p.currentLifecycler.Address()), Rules: []chain.Rule{{ Status: chain.Allow, Actions: chain.Actions{Names: []string{"*"}}, Resources: chain.Resources{Names: []string{"*"}}, - Condition: []chain.Condition{{ - Op: chain.CondStringEquals, - Kind: chain.KindRequest, - Key: native.PropertyKeyActorPublicKey, - Value: hex.EncodeToString(userKey.Bytes()), - }}, }}, } }