github.com/Finschia/finschia-sdk@v0.48.1/x/authz/authorizations.go (about)

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