plugin_approval

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultObjectStoreID = "platform-account"

DefaultObjectStoreID is the default object store ID for plugin approval lookups.

View Source
const DefaultVolumeID = ""

DefaultVolumeID is the default volume ID for plugin approval lookups.

View Source
const PluginApprovalKeyPrefix = "plugin-approval"

PluginApprovalKeyPrefix is the prefix for plugin approval keys.

Variables

View Source
var (
	PluginApprovalState_name = map[int32]string{
		0: "PluginApprovalState_UNSPECIFIED",
		1: "PluginApprovalState_APPROVED",
		2: "PluginApprovalState_DENIED",
	}
	PluginApprovalState_value = map[string]int32{
		"PluginApprovalState_UNSPECIFIED": 0,
		"PluginApprovalState_APPROVED":    1,
		"PluginApprovalState_DENIED":      2,
	}
)

Enum value maps for PluginApprovalState.

Functions

func CheckApproval

func CheckApproval(ctx context.Context, b bus.Bus, volumeID, objectStoreID, spaceID, manifestID string) (bool, error)

CheckApproval checks if a manifest ID is approved for a space.

volumeID defaults to PluginVolumeID if empty. objectStoreID defaults to "platform-account" if empty.

func IsApproved

func IsApproved(approval *PluginApproval) bool

IsApproved checks if the approval state is APPROVED.

func PluginApprovalKey

func PluginApprovalKey(spaceID, manifestID string) []byte

PluginApprovalKey returns the KV key for a plugin approval. Key format: plugin-approval/{space_id}/{manifest_id}

func SetPluginApproval

func SetPluginApproval(ctx context.Context, store kvtx.Store, spaceID, manifestID string, approval *PluginApproval) error

SetPluginApproval writes the PluginApproval to the store.

Types

type PluginApproval

type PluginApproval struct {

	// State is the approval decision.
	State PluginApprovalState `protobuf:"varint,1,opt,name=state,proto3" json:"state,omitempty"`
	// DecidedAt is when the decision was made.
	DecidedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=decided_at,json=decidedAt,proto3" json:"decidedAt,omitempty"`
	// contains filtered or unexported fields
}

PluginApproval records the user's approval decision for a plugin in a specific Space. Stored in the PlatformAccount KV store, not in shared Spaces.

func GetPluginApproval

func GetPluginApproval(ctx context.Context, store kvtx.Store, spaceID, manifestID string) (*PluginApproval, error)

GetPluginApproval reads the PluginApproval from the store. Returns nil, nil if the key is not found.

func (*PluginApproval) CloneMessageVT

func (m *PluginApproval) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*PluginApproval) CloneVT

func (m *PluginApproval) CloneVT() *PluginApproval

func (*PluginApproval) EqualMessageVT

func (this *PluginApproval) EqualMessageVT(thatMsg any) bool

func (*PluginApproval) EqualVT

func (this *PluginApproval) EqualVT(that *PluginApproval) bool

func (*PluginApproval) GetDecidedAt

func (x *PluginApproval) GetDecidedAt() *timestamppb.Timestamp

func (*PluginApproval) GetState

func (x *PluginApproval) GetState() PluginApprovalState

func (*PluginApproval) MarshalJSON

func (x *PluginApproval) MarshalJSON() ([]byte, error)

MarshalJSON marshals the PluginApproval to JSON.

func (*PluginApproval) MarshalProtoJSON

func (x *PluginApproval) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the PluginApproval message to JSON.

func (*PluginApproval) MarshalProtoText

func (x *PluginApproval) MarshalProtoText() string

func (*PluginApproval) MarshalToSizedBufferVT

func (m *PluginApproval) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*PluginApproval) MarshalToVT

func (m *PluginApproval) MarshalToVT(dAtA []byte) (int, error)

func (*PluginApproval) MarshalVT

func (m *PluginApproval) MarshalVT() (dAtA []byte, err error)

func (*PluginApproval) ProtoMessage

func (*PluginApproval) ProtoMessage()

func (*PluginApproval) Reset

func (x *PluginApproval) Reset()

func (*PluginApproval) SizeVT

func (m *PluginApproval) SizeVT() (n int)

func (*PluginApproval) String

func (x *PluginApproval) String() string

func (*PluginApproval) UnmarshalJSON

func (x *PluginApproval) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the PluginApproval from JSON.

func (*PluginApproval) UnmarshalProtoJSON

func (x *PluginApproval) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the PluginApproval message from JSON.

func (*PluginApproval) UnmarshalVT

func (m *PluginApproval) UnmarshalVT(dAtA []byte) error

type PluginApprovalState

type PluginApprovalState int32

PluginApprovalState is the approval state for a plugin.

const (
	// PluginApprovalState_UNSPECIFIED means no decision yet.
	PluginApprovalState_PluginApprovalState_UNSPECIFIED PluginApprovalState = 0
	// PluginApprovalState_APPROVED means the user approved loading.
	PluginApprovalState_PluginApprovalState_APPROVED PluginApprovalState = 1
	// PluginApprovalState_DENIED means the user denied loading.
	PluginApprovalState_PluginApprovalState_DENIED PluginApprovalState = 2
)

func GetApprovalState

func GetApprovalState(ctx context.Context, b bus.Bus, volumeID, objectStoreID, spaceID, manifestID string) (PluginApprovalState, error)

GetApprovalState returns the approval state for a manifest ID in a space.

volumeID defaults to PluginVolumeID if empty. objectStoreID defaults to "platform-account" if empty.

func (PluginApprovalState) Enum

func (PluginApprovalState) MarshalJSON

func (x PluginApprovalState) MarshalJSON() ([]byte, error)

MarshalJSON marshals the PluginApprovalState to JSON.

func (PluginApprovalState) MarshalProtoJSON

func (x PluginApprovalState) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the PluginApprovalState to JSON.

func (PluginApprovalState) MarshalProtoText

func (x PluginApprovalState) MarshalProtoText() string

func (PluginApprovalState) MarshalText

func (x PluginApprovalState) MarshalText() ([]byte, error)

MarshalText marshals the PluginApprovalState to text.

func (PluginApprovalState) String

func (x PluginApprovalState) String() string

func (*PluginApprovalState) UnmarshalJSON

func (x *PluginApprovalState) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the PluginApprovalState from JSON.

func (*PluginApprovalState) UnmarshalProtoJSON

func (x *PluginApprovalState) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the PluginApprovalState from JSON.

func (*PluginApprovalState) UnmarshalText

func (x *PluginApprovalState) UnmarshalText(b []byte) error

UnmarshalText unmarshals the PluginApprovalState from text.

Jump to

Keyboard shortcuts

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