types

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2023 License: GPL-3.0 Imports: 33 Imported by: 16

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	// ModuleName defines the module name
	ModuleName = "permission"

	// StoreKey defines the primary module store key
	StoreKey = ModuleName

	// RouterKey defines the module's message routing key
	RouterKey = ModuleName

	// MemStoreKey defines the in-memory store key
	MemStoreKey = "mem_permission"
)
View Source
const (
	DefaultMaxStatementsNum  uint64 = 10
	DefaultMaxPolicyGroupNum uint64 = 10
)
View Source
const DefaultIndex uint64 = 1

DefaultIndex is the default global index

Variables

View Source
var (
	ErrInvalidLengthCommon        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCommon          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCommon = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidPrincipal    = errors.Register(ModuleName, 1100, "Invalid principal")
	ErrInvalidStatement    = errors.Register(ModuleName, 1101, "Invalid statement")
	ErrInvalidPolicy       = errors.Register(ModuleName, 1102, "Invalid policy")
	ErrInvalidResourceType = errors.Register(ModuleName, 1103, "Invalid resource type")
	ErrLimitExceeded       = errors.Register(ModuleName, 1105, "Num limit exceeded")
)

x/permission module sentinel errors

View Source
var (
	ErrInvalidLengthEvents        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEvents          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	BucketPolicyForAccountPrefix = []byte{0x11}
	ObjectPolicyForAccountPrefix = []byte{0x12}
	GroupPolicyForAccountPrefix  = []byte{0x13}

	BucketPolicyForGroupPrefix = []byte{0x21}
	ObjectPolicyForGroupPrefix = []byte{0x22}

	PolicyByIDPrefix = []byte{0x31}

	PolicySequencePrefix = []byte{0x41}
)
View Source
var (
	KeyMaxStatementsNum  = []byte("MaxStatementsNum")
	KeyMaxPolicyGroupNum = []byte("MaxPolicyGroupNum")
)
View Source
var (
	ErrInvalidLengthParams        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowParams          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ActionType_name = map[int32]string{
	0:  "ACTION_UPDATE_BUCKET_INFO",
	1:  "ACTION_DELETE_BUCKET",
	2:  "ACTION_CREATE_OBJECT",
	3:  "ACTION_DELETE_OBJECT",
	4:  "ACTION_COPY_OBJECT",
	5:  "ACTION_GET_OBJECT",
	6:  "ACTION_EXECUTE_OBJECT",
	7:  "ACTION_LIST_OBJECT",
	8:  "ACTION_UPDATE_GROUP_MEMBER",
	9:  "ACTION_DELETE_GROUP",
	10: "ACTION_GROUP_MEMBER",
	99: "ACTION_TYPE_ALL",
}
View Source
var ActionType_value = map[string]int32{
	"ACTION_UPDATE_BUCKET_INFO":  0,
	"ACTION_DELETE_BUCKET":       1,
	"ACTION_CREATE_OBJECT":       2,
	"ACTION_DELETE_OBJECT":       3,
	"ACTION_COPY_OBJECT":         4,
	"ACTION_GET_OBJECT":          5,
	"ACTION_EXECUTE_OBJECT":      6,
	"ACTION_LIST_OBJECT":         7,
	"ACTION_UPDATE_GROUP_MEMBER": 8,
	"ACTION_DELETE_GROUP":        9,
	"ACTION_GROUP_MEMBER":        10,
	"ACTION_TYPE_ALL":            99,
}
View Source
var Effect_name = map[int32]string{
	0: "EFFECT_ALLOW",
	1: "EFFECT_DENY",
	2: "EFFECT_PASS",
}
View Source
var Effect_value = map[string]int32{
	"EFFECT_ALLOW": 0,
	"EFFECT_DENY":  1,
	"EFFECT_PASS":  2,
}
View Source
var PrincipalType_name = map[int32]string{
	0: "TYPE_GNFD_ACCOUNT",
	1: "TYPE_GNFD_GROUP",
}
View Source
var PrincipalType_value = map[string]int32{
	"TYPE_GNFD_ACCOUNT": 0,
	"TYPE_GNFD_GROUP":   1,
}

Functions

func GetBucketPolicyForAccountKey added in v0.0.8

func GetBucketPolicyForAccountKey(resourceID math.Uint, addr sdk.AccAddress) []byte

func GetBucketPolicyForGroupKey added in v0.0.8

func GetBucketPolicyForGroupKey(resourceID math.Uint) []byte

func GetGroupPolicyForAccountKey added in v0.0.8

func GetGroupPolicyForAccountKey(resourceID math.Uint, addr sdk.AccAddress) []byte

func GetObjectPolicyForAccountKey added in v0.0.8

func GetObjectPolicyForAccountKey(resourceID math.Uint, addr sdk.AccAddress) []byte

func GetObjectPolicyForGroupKey added in v0.0.8

func GetObjectPolicyForGroupKey(resourceID math.Uint) []byte

func GetPolicyByIDKey

func GetPolicyByIDKey(policyID math.Uint) []byte

func GetPolicyForAccountKey added in v0.0.8

func GetPolicyForAccountKey(resourceID math.Uint, resourceType resource.ResourceType, addr sdk.AccAddress) []byte

func GetPolicyForGroupKey added in v0.0.8

func GetPolicyForGroupKey(resourceID math.Uint, resourceType resource.ResourceType) []byte

func KeyPrefix

func KeyPrefix(p string) []byte

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable the param key table for launch module

func RegisterCodec

func RegisterCodec(cdc *codec.LegacyAmino)

func RegisterInterfaces

func RegisterInterfaces(registry cdctypes.InterfaceRegistry)

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI
}

AccountKeeper defines the expected account keeper used for simulations (noalias)

type ActionType

type ActionType int32

ActionType defines the operations you can execute in greenfield storage network

const (
	ACTION_UPDATE_BUCKET_INFO  ActionType = 0
	ACTION_DELETE_BUCKET       ActionType = 1
	ACTION_CREATE_OBJECT       ActionType = 2
	ACTION_DELETE_OBJECT       ActionType = 3
	ACTION_COPY_OBJECT         ActionType = 4
	ACTION_GET_OBJECT          ActionType = 5
	ACTION_EXECUTE_OBJECT      ActionType = 6
	ACTION_LIST_OBJECT         ActionType = 7
	ACTION_UPDATE_GROUP_MEMBER ActionType = 8
	ACTION_DELETE_GROUP        ActionType = 9
	ACTION_GROUP_MEMBER        ActionType = 10
	ACTION_TYPE_ALL            ActionType = 99
)

func (ActionType) EnumDescriptor

func (ActionType) EnumDescriptor() ([]byte, []int)

func (ActionType) String

func (x ActionType) String() string

type BankKeeper

type BankKeeper interface {
	SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
}

BankKeeper defines the expected interface needed to retrieve account balances.

type Effect

type Effect int32

Effect define the effect of the operation permission, include Allow or deny

const (
	EFFECT_ALLOW Effect = 0
	EFFECT_DENY  Effect = 1
	// Use internally, means skipped. there is no explicit ALLOW or DENY, and further permission checks are required.
	EFFECT_PASS Effect = 2
)

func (Effect) EnumDescriptor

func (Effect) EnumDescriptor() ([]byte, []int)

func (Effect) String

func (x Effect) String() string

type EventDeletePolicy added in v0.0.9

type EventDeletePolicy struct {
	// policy_id is an unique u256 sequence for each policy. It also be used as NFT tokenID
	PolicyId Uint `protobuf:"bytes,1,opt,name=policy_id,json=policyId,proto3,customtype=Uint" json:"policy_id"`
}

func (*EventDeletePolicy) Descriptor added in v0.0.9

func (*EventDeletePolicy) Descriptor() ([]byte, []int)

func (*EventDeletePolicy) Marshal added in v0.0.9

func (m *EventDeletePolicy) Marshal() (dAtA []byte, err error)

func (*EventDeletePolicy) MarshalTo added in v0.0.9

func (m *EventDeletePolicy) MarshalTo(dAtA []byte) (int, error)

func (*EventDeletePolicy) MarshalToSizedBuffer added in v0.0.9

func (m *EventDeletePolicy) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventDeletePolicy) ProtoMessage added in v0.0.9

func (*EventDeletePolicy) ProtoMessage()

func (*EventDeletePolicy) Reset added in v0.0.9

func (m *EventDeletePolicy) Reset()

func (*EventDeletePolicy) Size added in v0.0.9

func (m *EventDeletePolicy) Size() (n int)

func (*EventDeletePolicy) String added in v0.0.9

func (m *EventDeletePolicy) String() string

func (*EventDeletePolicy) Unmarshal added in v0.0.9

func (m *EventDeletePolicy) Unmarshal(dAtA []byte) error

func (*EventDeletePolicy) XXX_DiscardUnknown added in v0.0.9

func (m *EventDeletePolicy) XXX_DiscardUnknown()

func (*EventDeletePolicy) XXX_Marshal added in v0.0.9

func (m *EventDeletePolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventDeletePolicy) XXX_Merge added in v0.0.9

func (m *EventDeletePolicy) XXX_Merge(src proto.Message)

func (*EventDeletePolicy) XXX_Size added in v0.0.9

func (m *EventDeletePolicy) XXX_Size() int

func (*EventDeletePolicy) XXX_Unmarshal added in v0.0.9

func (m *EventDeletePolicy) XXX_Unmarshal(b []byte) error

type EventPutPolicy added in v0.0.9

type EventPutPolicy struct {
	// policy_id is an unique u256 sequence for each policy. It also be used as NFT tokenID
	PolicyId Uint `protobuf:"bytes,1,opt,name=policy_id,json=policyId,proto3,customtype=Uint" json:"policy_id"`
	// principal defines the accounts/group which the permission grants to
	Principal *Principal `protobuf:"bytes,2,opt,name=principal,proto3" json:"principal,omitempty"`
	// resource_type defines the type of resource that grants permission for
	ResourceType resource.ResourceType `` /* 145-byte string literal not displayed */
	// resource_id defines the bucket/object/group id of the resource that grants permission for
	ResourceId Uint `protobuf:"bytes,4,opt,name=resource_id,json=resourceId,proto3,customtype=Uint" json:"resource_id"`
	// statements defines the details content of the permission, include effect/actions/sub-resources
	Statements []*Statement `protobuf:"bytes,5,rep,name=statements,proto3" json:"statements,omitempty"`
}

func (*EventPutPolicy) Descriptor added in v0.0.9

func (*EventPutPolicy) Descriptor() ([]byte, []int)

func (*EventPutPolicy) GetPrincipal added in v0.0.9

func (m *EventPutPolicy) GetPrincipal() *Principal

func (*EventPutPolicy) GetResourceType added in v0.0.9

func (m *EventPutPolicy) GetResourceType() resource.ResourceType

func (*EventPutPolicy) GetStatements added in v0.0.9

func (m *EventPutPolicy) GetStatements() []*Statement

func (*EventPutPolicy) Marshal added in v0.0.9

func (m *EventPutPolicy) Marshal() (dAtA []byte, err error)

func (*EventPutPolicy) MarshalTo added in v0.0.9

func (m *EventPutPolicy) MarshalTo(dAtA []byte) (int, error)

func (*EventPutPolicy) MarshalToSizedBuffer added in v0.0.9

func (m *EventPutPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventPutPolicy) ProtoMessage added in v0.0.9

func (*EventPutPolicy) ProtoMessage()

func (*EventPutPolicy) Reset added in v0.0.9

func (m *EventPutPolicy) Reset()

func (*EventPutPolicy) Size added in v0.0.9

func (m *EventPutPolicy) Size() (n int)

func (*EventPutPolicy) String added in v0.0.9

func (m *EventPutPolicy) String() string

func (*EventPutPolicy) Unmarshal added in v0.0.9

func (m *EventPutPolicy) Unmarshal(dAtA []byte) error

func (*EventPutPolicy) XXX_DiscardUnknown added in v0.0.9

func (m *EventPutPolicy) XXX_DiscardUnknown()

func (*EventPutPolicy) XXX_Marshal added in v0.0.9

func (m *EventPutPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventPutPolicy) XXX_Merge added in v0.0.9

func (m *EventPutPolicy) XXX_Merge(src proto.Message)

func (*EventPutPolicy) XXX_Size added in v0.0.9

func (m *EventPutPolicy) XXX_Size() int

func (*EventPutPolicy) XXX_Unmarshal added in v0.0.9

func (m *EventPutPolicy) XXX_Unmarshal(b []byte) error

type GenesisState

type GenesisState struct {
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

GenesisState defines the permission module's genesis state.

func DefaultGenesis

func DefaultGenesis() *GenesisState

DefaultGenesis returns the default genesis state

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type Int

type Int = math.Int

type MsgClient

type MsgClient interface {
}

MsgClient is the client API for Msg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgServer

type MsgServer interface {
}

MsgServer is the server API for Msg service.

type Params

type Params struct {
	MaximumStatementsNum uint64 `protobuf:"varint,1,opt,name=maximum_statements_num,json=maximumStatementsNum,proto3" json:"maximum_statements_num,omitempty"`
	MaximumGroupNum      uint64 `protobuf:"varint,2,opt,name=maximum_group_num,json=maximumGroupNum,proto3" json:"maximum_group_num,omitempty"`
}

Params defines the parameters for the module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters

func NewParams

func NewParams(maximumStatementsNum, maximumGroupNum uint64) Params

NewParams creates a new Params instance

func (*Params) Descriptor

func (*Params) Descriptor() ([]byte, []int)

func (*Params) GetMaximumGroupNum

func (m *Params) GetMaximumGroupNum() uint64

func (*Params) GetMaximumStatementsNum

func (m *Params) GetMaximumStatementsNum() uint64

func (*Params) Marshal

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs

ParamSetPairs get the params.ParamSet

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

func (m *Params) Size() (n int)

func (Params) String

func (p Params) String() string

String implements the Stringer interface.

func (*Params) Unmarshal

func (m *Params) Unmarshal(dAtA []byte) error

func (Params) Validate

func (p Params) Validate() error

Validate validates the set of params

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

func (m *Params) XXX_Unmarshal(b []byte) error

type Policy

type Policy struct {
	Id              Uint                  `protobuf:"bytes,1,opt,name=id,proto3,customtype=Uint" json:"id"`
	Principal       *Principal            `protobuf:"bytes,2,opt,name=principal,proto3" json:"principal,omitempty"`
	ResourceType    resource.ResourceType `` /* 145-byte string literal not displayed */
	ResourceId      Uint                  `protobuf:"bytes,4,opt,name=resource_id,json=resourceId,proto3,customtype=Uint" json:"resource_id"`
	Statements      []*Statement          `protobuf:"bytes,5,rep,name=statements,proto3" json:"statements,omitempty"`
	MemberStatement *Statement            `protobuf:"bytes,6,opt,name=member_statement,json=memberStatement,proto3" json:"member_statement,omitempty"`
}

func NewDefaultPolicyForGroupMember

func NewDefaultPolicyForGroupMember(groupID math.Uint, member sdk.AccAddress) *Policy

func (*Policy) Descriptor

func (*Policy) Descriptor() ([]byte, []int)

func (*Policy) Eval

func (p *Policy) Eval(action ActionType, resource *string) Effect

func (*Policy) GetGroupMemberStatement

func (p *Policy) GetGroupMemberStatement() (*Statement, bool)

func (*Policy) GetMemberStatement

func (m *Policy) GetMemberStatement() *Statement

func (*Policy) GetPrincipal

func (m *Policy) GetPrincipal() *Principal

func (*Policy) GetResourceType

func (m *Policy) GetResourceType() resource.ResourceType

func (*Policy) GetStatements

func (m *Policy) GetStatements() []*Statement

func (*Policy) Marshal

func (m *Policy) Marshal() (dAtA []byte, err error)

func (*Policy) MarshalTo

func (m *Policy) MarshalTo(dAtA []byte) (int, error)

func (*Policy) MarshalToSizedBuffer

func (m *Policy) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Policy) ProtoMessage

func (*Policy) ProtoMessage()

func (*Policy) Reset

func (m *Policy) Reset()

func (*Policy) Size

func (m *Policy) Size() (n int)

func (*Policy) String

func (m *Policy) String() string

func (*Policy) Unmarshal

func (m *Policy) Unmarshal(dAtA []byte) error

func (*Policy) XXX_DiscardUnknown

func (m *Policy) XXX_DiscardUnknown()

func (*Policy) XXX_Marshal

func (m *Policy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Policy) XXX_Merge

func (m *Policy) XXX_Merge(src proto.Message)

func (*Policy) XXX_Size

func (m *Policy) XXX_Size() int

func (*Policy) XXX_Unmarshal

func (m *Policy) XXX_Unmarshal(b []byte) error

type PolicyGroup

type PolicyGroup struct {
	Items []*PolicyGroup_Item `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
}

func (*PolicyGroup) Descriptor

func (*PolicyGroup) Descriptor() ([]byte, []int)

func (*PolicyGroup) GetItems

func (m *PolicyGroup) GetItems() []*PolicyGroup_Item

func (*PolicyGroup) Marshal

func (m *PolicyGroup) Marshal() (dAtA []byte, err error)

func (*PolicyGroup) MarshalTo

func (m *PolicyGroup) MarshalTo(dAtA []byte) (int, error)

func (*PolicyGroup) MarshalToSizedBuffer

func (m *PolicyGroup) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PolicyGroup) ProtoMessage

func (*PolicyGroup) ProtoMessage()

func (*PolicyGroup) Reset

func (m *PolicyGroup) Reset()

func (*PolicyGroup) Size

func (m *PolicyGroup) Size() (n int)

func (*PolicyGroup) String

func (m *PolicyGroup) String() string

func (*PolicyGroup) Unmarshal

func (m *PolicyGroup) Unmarshal(dAtA []byte) error

func (*PolicyGroup) XXX_DiscardUnknown

func (m *PolicyGroup) XXX_DiscardUnknown()

func (*PolicyGroup) XXX_Marshal

func (m *PolicyGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PolicyGroup) XXX_Merge

func (m *PolicyGroup) XXX_Merge(src proto.Message)

func (*PolicyGroup) XXX_Size

func (m *PolicyGroup) XXX_Size() int

func (*PolicyGroup) XXX_Unmarshal

func (m *PolicyGroup) XXX_Unmarshal(b []byte) error

type PolicyGroup_Item

type PolicyGroup_Item struct {
	PolicyId Uint `protobuf:"bytes,1,opt,name=policy_id,json=policyId,proto3,customtype=Uint" json:"policy_id"`
	GroupId  Uint `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3,customtype=Uint" json:"group_id"`
}

func (*PolicyGroup_Item) Descriptor

func (*PolicyGroup_Item) Descriptor() ([]byte, []int)

func (*PolicyGroup_Item) Marshal

func (m *PolicyGroup_Item) Marshal() (dAtA []byte, err error)

func (*PolicyGroup_Item) MarshalTo

func (m *PolicyGroup_Item) MarshalTo(dAtA []byte) (int, error)

func (*PolicyGroup_Item) MarshalToSizedBuffer

func (m *PolicyGroup_Item) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PolicyGroup_Item) ProtoMessage

func (*PolicyGroup_Item) ProtoMessage()

func (*PolicyGroup_Item) Reset

func (m *PolicyGroup_Item) Reset()

func (*PolicyGroup_Item) Size

func (m *PolicyGroup_Item) Size() (n int)

func (*PolicyGroup_Item) String

func (m *PolicyGroup_Item) String() string

func (*PolicyGroup_Item) Unmarshal

func (m *PolicyGroup_Item) Unmarshal(dAtA []byte) error

func (*PolicyGroup_Item) XXX_DiscardUnknown

func (m *PolicyGroup_Item) XXX_DiscardUnknown()

func (*PolicyGroup_Item) XXX_Marshal

func (m *PolicyGroup_Item) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PolicyGroup_Item) XXX_Merge

func (m *PolicyGroup_Item) XXX_Merge(src proto.Message)

func (*PolicyGroup_Item) XXX_Size

func (m *PolicyGroup_Item) XXX_Size() int

func (*PolicyGroup_Item) XXX_Unmarshal

func (m *PolicyGroup_Item) XXX_Unmarshal(b []byte) error

type Principal

type Principal struct {
	Type  PrincipalType `protobuf:"varint,1,opt,name=type,proto3,enum=bnbchain.greenfield.permission.PrincipalType" json:"type,omitempty"`
	Value string        `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}

Principal define the roles that can grant permissions. Currently, it can be account or group.

func NewPrincipalWithAccount

func NewPrincipalWithAccount(addr sdk.AccAddress) *Principal

func NewPrincipalWithGroup added in v0.0.8

func NewPrincipalWithGroup(groupID sdkmath.Uint) *Principal

func (*Principal) Descriptor

func (*Principal) Descriptor() ([]byte, []int)

func (*Principal) GetAccountAddress

func (p *Principal) GetAccountAddress() (sdk.AccAddress, error)

func (*Principal) GetGroupID

func (p *Principal) GetGroupID() (sdkmath.Uint, error)

func (*Principal) GetType

func (m *Principal) GetType() PrincipalType

func (*Principal) GetValue

func (m *Principal) GetValue() string

func (*Principal) Marshal

func (m *Principal) Marshal() (dAtA []byte, err error)

func (*Principal) MarshalTo

func (m *Principal) MarshalTo(dAtA []byte) (int, error)

func (*Principal) MarshalToSizedBuffer

func (m *Principal) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Principal) MustGetAccountAddress

func (p *Principal) MustGetAccountAddress() sdk.AccAddress

func (*Principal) MustGetGroupID

func (p *Principal) MustGetGroupID() sdkmath.Uint

func (*Principal) ProtoMessage

func (*Principal) ProtoMessage()

func (*Principal) Reset

func (m *Principal) Reset()

func (*Principal) Size

func (m *Principal) Size() (n int)

func (*Principal) String

func (m *Principal) String() string

func (*Principal) Unmarshal

func (m *Principal) Unmarshal(dAtA []byte) error

func (*Principal) ValidateBasic

func (p *Principal) ValidateBasic() error

func (*Principal) XXX_DiscardUnknown

func (m *Principal) XXX_DiscardUnknown()

func (*Principal) XXX_Marshal

func (m *Principal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Principal) XXX_Merge

func (m *Principal) XXX_Merge(src proto.Message)

func (*Principal) XXX_Size

func (m *Principal) XXX_Size() int

func (*Principal) XXX_Unmarshal

func (m *Principal) XXX_Unmarshal(b []byte) error

type PrincipalType

type PrincipalType int32
const (
	// Reserved for extended use
	TYPE_GNFD_ACCOUNT PrincipalType = 0
	TYPE_GNFD_GROUP   PrincipalType = 1
)

func (PrincipalType) EnumDescriptor

func (PrincipalType) EnumDescriptor() ([]byte, []int)

func (PrincipalType) String

func (x PrincipalType) String() string

type QueryClient

type QueryClient interface {
	// Parameters queries the parameters of the module.
	Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryParamsRequest

type QueryParamsRequest struct {
}

QueryParamsRequest is request type for the Query/Params RPC method.

func (*QueryParamsRequest) Descriptor

func (*QueryParamsRequest) Descriptor() ([]byte, []int)

func (*QueryParamsRequest) Marshal

func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error)

func (*QueryParamsRequest) MarshalTo

func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryParamsRequest) MarshalToSizedBuffer

func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryParamsRequest) ProtoMessage

func (*QueryParamsRequest) ProtoMessage()

func (*QueryParamsRequest) Reset

func (m *QueryParamsRequest) Reset()

func (*QueryParamsRequest) Size

func (m *QueryParamsRequest) Size() (n int)

func (*QueryParamsRequest) String

func (m *QueryParamsRequest) String() string

func (*QueryParamsRequest) Unmarshal

func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error

func (*QueryParamsRequest) XXX_DiscardUnknown

func (m *QueryParamsRequest) XXX_DiscardUnknown()

func (*QueryParamsRequest) XXX_Marshal

func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryParamsRequest) XXX_Merge

func (m *QueryParamsRequest) XXX_Merge(src proto.Message)

func (*QueryParamsRequest) XXX_Size

func (m *QueryParamsRequest) XXX_Size() int

func (*QueryParamsRequest) XXX_Unmarshal

func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error

type QueryParamsResponse

type QueryParamsResponse struct {
	// params holds all the parameters of this module.
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

QueryParamsResponse is response type for the Query/Params RPC method.

func (*QueryParamsResponse) Descriptor

func (*QueryParamsResponse) Descriptor() ([]byte, []int)

func (*QueryParamsResponse) GetParams

func (m *QueryParamsResponse) GetParams() Params

func (*QueryParamsResponse) Marshal

func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error)

func (*QueryParamsResponse) MarshalTo

func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryParamsResponse) MarshalToSizedBuffer

func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryParamsResponse) ProtoMessage

func (*QueryParamsResponse) ProtoMessage()

func (*QueryParamsResponse) Reset

func (m *QueryParamsResponse) Reset()

func (*QueryParamsResponse) Size

func (m *QueryParamsResponse) Size() (n int)

func (*QueryParamsResponse) String

func (m *QueryParamsResponse) String() string

func (*QueryParamsResponse) Unmarshal

func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error

func (*QueryParamsResponse) XXX_DiscardUnknown

func (m *QueryParamsResponse) XXX_DiscardUnknown()

func (*QueryParamsResponse) XXX_Marshal

func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryParamsResponse) XXX_Merge

func (m *QueryParamsResponse) XXX_Merge(src proto.Message)

func (*QueryParamsResponse) XXX_Size

func (m *QueryParamsResponse) XXX_Size() int

func (*QueryParamsResponse) XXX_Unmarshal

func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error

type QueryServer

type QueryServer interface {
	// Parameters queries the parameters of the module.
	Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
}

QueryServer is the server API for Query service.

type Statement

type Statement struct {
	// effect define the impact of permissions, which can be Allow/Deny
	Effect Effect `protobuf:"varint,1,opt,name=effect,proto3,enum=bnbchain.greenfield.permission.Effect" json:"effect,omitempty"`
	// action_type define the operation type you can act. greenfield defines a set of permission
	// that you can specify in a permissionInfo. see ActionType enum for detail.
	Actions []ActionType `protobuf:"varint,2,rep,packed,name=actions,proto3,enum=bnbchain.greenfield.permission.ActionType" json:"actions,omitempty"`
	// resources define the resource list you can operate.
	// CAN ONLY USED IN bucket level. Support fuzzy match and limit to 5
	Resources []string `protobuf:"bytes,3,rep,name=resources,proto3" json:"resources,omitempty"`
}

TODO: add expiration time.

func NewMemberStatement

func NewMemberStatement() *Statement

func (*Statement) Descriptor

func (*Statement) Descriptor() ([]byte, []int)

func (*Statement) Eval

func (s *Statement) Eval(action ActionType, resource *string) Effect

func (*Statement) GetActions

func (m *Statement) GetActions() []ActionType

func (*Statement) GetEffect

func (m *Statement) GetEffect() Effect

func (*Statement) GetResources

func (m *Statement) GetResources() []string

func (*Statement) Marshal

func (m *Statement) Marshal() (dAtA []byte, err error)

func (*Statement) MarshalTo

func (m *Statement) MarshalTo(dAtA []byte) (int, error)

func (*Statement) MarshalToSizedBuffer

func (m *Statement) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Statement) ProtoMessage

func (*Statement) ProtoMessage()

func (*Statement) Reset

func (m *Statement) Reset()

func (*Statement) Size

func (m *Statement) Size() (n int)

func (*Statement) String

func (m *Statement) String() string

func (*Statement) Unmarshal

func (m *Statement) Unmarshal(dAtA []byte) error

func (*Statement) ValidateBasic

func (s *Statement) ValidateBasic() error

func (*Statement) XXX_DiscardUnknown

func (m *Statement) XXX_DiscardUnknown()

func (*Statement) XXX_Marshal

func (m *Statement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Statement) XXX_Merge

func (m *Statement) XXX_Merge(src proto.Message)

func (*Statement) XXX_Size

func (m *Statement) XXX_Size() int

func (*Statement) XXX_Unmarshal

func (m *Statement) XXX_Unmarshal(b []byte) error

type Uint

type Uint = math.Uint

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) Params

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL