github.com/cosmos/cosmos-sdk@v0.50.10/x/authz/authorizations.go (about) 1 package authz 2 3 import ( 4 context "context" 5 6 "github.com/cosmos/gogoproto/proto" 7 8 sdk "github.com/cosmos/cosmos-sdk/types" 9 ) 10 11 // Authorization represents the interface of various Authorization types implemented 12 // by other modules. 13 type Authorization interface { 14 proto.Message 15 16 // MsgTypeURL returns the fully-qualified Msg service method URL (as described in ADR 031), 17 // which will process and accept or reject a request. 18 MsgTypeURL() string 19 20 // Accept determines whether this grant permits the provided sdk.Msg to be performed, 21 // and if so provides an upgraded authorization instance. 22 Accept(ctx context.Context, msg sdk.Msg) (AcceptResponse, error) 23 24 // ValidateBasic does a simple validation check that 25 // doesn't require access to any other information. 26 ValidateBasic() error 27 } 28 29 // AcceptResponse instruments the controller of an authz message if the request is accepted 30 // and if it should be updated or deleted. 31 type AcceptResponse struct { 32 // If Accept=true, the controller can accept and authorization and handle the update. 33 Accept bool 34 // If Delete=true, the controller must delete the authorization object and release 35 // storage resources. 36 Delete bool 37 // Controller, who is calling Authorization.Accept must check if `Updated != nil`. If yes, 38 // it must use the updated version and handle the update on the storage level. 39 Updated Authorization 40 }