model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TKeelUser   = "_tKeel"
	TKeelTenant = "_tKeel_system"

	AdminRole = "admin"

	KeyAdminPassword = "admin_passwd"

	KeyPermissionSet = "permission_set"

	KeyPlatExtraConfig = "platform_extra"

	AllowedPermissionAction = "_tkeel_allow"

	TkeelTenantAdminRole = "管理员"
	TKeelTenantAdminDesc = "默认拥有租户空间下所有权限"
)

Variables

View Source
var (
	ErrPermissionExist                   = errors.New("Permission exist")
	ErrPermissionNotExist                = errors.New("Permission not exist")
	ErrPermissionNotRoot                 = errors.New("Permission not be root")
	ErrDuplicatePermissionAsTheSameLevel = errors.New("Duplicate permissions at the same level")
	ErrPermissionDependencyNotExist      = errors.New("Permission dependency does not exist")
)
View Source
var (
	XPluginJwtHeader = http.CanonicalHeaderKey("x-plugin-jwt")
	XtKeelAuthHeader = http.CanonicalHeaderKey("x-tKeel-auth")

	AuthorizationHeader = http.CanonicalHeaderKey("Authorization")

	ContentTypeHeader = http.CanonicalHeaderKey("Content-Type")

	TKeelComponents = []string{
		"rudder", "core", "keel", "security",
	}

	TKeelConsole = []string{
		"console-plugin-tenant-plugins", "console-plugin-tenant-roles", "console-plugin-tenant-users",
	}
)

Functions

func Base64Decode added in v0.3.0

func Base64Decode(p string) string

func Base64Encode added in v0.3.0

func Base64Encode(p string) string

func Clone

func Clone(src, dst interface{}) error

func ClonePermission added in v0.4.0

func ClonePermission(pb *openapi_v1.Permission) *openapi_v1.Permission

Types

type Annotations added in v0.3.0

type Annotations map[string]interface{}

type EnableTenant added in v0.4.0

type EnableTenant struct {
	TenantID        string `json:"tenant_id"`        // enable tenant id.
	OperatorID      string `json:"operator_id"`      // operator id.
	EnableTimestamp int64  `json:"enable_timestamp"` // enable timestamp.
}

func (*EnableTenant) String added in v0.4.0

func (et *EnableTenant) String() string

type Installer added in v0.3.0

type Installer struct {
	Repo       string                   `json:"repo,omitempty"`       // repo name.
	Name       string                   `json:"name,omitempty"`       // installer name.
	Version    string                   `json:"version,omitempty"`    // installer version.
	Icon       string                   `json:"icon,omitempty"`       // installer icon.
	Desc       string                   `json:"desc,omitempty"`       // installer desc.
	Maintainer []*repository.Maintainer `json:"maintainer,omitempty"` // installer maintainer.
}

type Permission added in v0.4.0

type Permission struct {
	Path string
	Pb   *openapi_v1.Permission
}

func (*Permission) Clone added in v0.4.0

func (p *Permission) Clone() *Permission

type PermissionSet added in v0.4.0

type PermissionSet struct {
	// contains filtered or unexported fields
}

func GetPermissionSet added in v0.4.0

func GetPermissionSet() *PermissionSet

func NewPermissionSet added in v0.4.0

func NewPermissionSet() *PermissionSet

func (*PermissionSet) Add added in v0.4.0

func (ps *PermissionSet) Add(pluginID string, pb *openapi_v1.Permission) (bool, error)

func (*PermissionSet) Delete added in v0.4.0

func (ps *PermissionSet) Delete(pluginID string)

func (*PermissionSet) GetAllPermissionByPluginID added in v0.4.0

func (ps *PermissionSet) GetAllPermissionByPluginID(pluginID string) []*Permission

func (*PermissionSet) GetPermission added in v0.4.0

func (ps *PermissionSet) GetPermission(path string) (*Permission, error)

func (*PermissionSet) GetPermissionByPluginID added in v0.4.0

func (ps *PermissionSet) GetPermissionByPluginID(pluginID string) *Permission

func (*PermissionSet) GetSortList added in v0.4.0

func (ps *PermissionSet) GetSortList() []*Permission

func (*PermissionSet) Marshall added in v0.4.0

func (ps *PermissionSet) Marshall() ([]byte, error)

func (*PermissionSet) NewPluginAllowedPermission added in v0.4.0

func (ps *PermissionSet) NewPluginAllowedPermission(pluginID string) *Permission

func (*PermissionSet) Unmarshal added in v0.4.0

func (ps *PermissionSet) Unmarshal(b []byte) error

type PermissionSort added in v0.4.0

type PermissionSort []*Permission

func (PermissionSort) Len added in v0.4.0

func (a PermissionSort) Len() int

func (PermissionSort) Less added in v0.4.0

func (a PermissionSort) Less(i, j int) bool

func (PermissionSort) Swap added in v0.4.0

func (a PermissionSort) Swap(i, j int)

type Plugin

type Plugin struct {
	ID                      string                          `json:"id,omitempty"`                        // plugin id.
	Installer               *Installer                      `json:"installer,omitempty"`                 // plugin installer.
	PluginVersion           string                          `json:"plugin_version,omitempty"`            // plugin version.
	TkeelVersion            string                          `json:"tkeel_version,omitempty"`             // plugin depend tkeel version.
	AddonsPoint             []*openapi_v1.AddonsPoint       `json:"addons_point,omitempty"`              // plugin declares addons.
	ImplementedPlugin       []*openapi_v1.ImplementedPlugin `json:"implemented_plugin,omitempty"`        // plugin implemented plugin list.
	ConsoleEntries          []*openapi_v1.ConsoleEntry      `json:"console_entries,omitempty"`           // plugin console entries.
	PluginDependences       []*openapi_v1.BriefPluginInfo   `json:"plugin_dependences,omitempty"`        // plugin dependences.
	Permissions             []*openapi_v1.Permission        `json:"permissions,omitempty"`               // plugin permissions.
	Secret                  string                          `json:"secret,omitempty"`                    // plugin registered secret.
	RegisterTimestamp       int64                           `json:"register_timestamp,omitempty"`        // register timestamp.
	Version                 string                          `json:"version,omitempty"`                   // model version.
	Status                  openapi_v1.PluginStatus         `json:"status,omitempty"`                    // plugin state.
	EnableTenantes          []*EnableTenant                 `json:"enable_tenantes,omitempty"`           // plugin active tenantes.
	DisableManualActivation bool                            `json:"disable_manual_activation,omitempty"` // plugin disable manual activation.
	Profiles                interface{}                     `json:"profiles,omitempty"`                  // plugin profile.
}

func NewPlugin

func NewPlugin(pluginID string, installer *Installer) *Plugin

func (*Plugin) CheckTenantEnable added in v0.4.0

func (p *Plugin) CheckTenantEnable(tenantID string) bool

func (*Plugin) Clone

func (p *Plugin) Clone() *Plugin

func (*Plugin) Register added in v0.3.0

func (p *Plugin) Register(resp *openapi_v1.IdentifyResponse, secret string)

func (*Plugin) String

func (p *Plugin) String() string

func (*Plugin) TenantDisable added in v0.4.0

func (p *Plugin) TenantDisable(tenantID string) bool

func (*Plugin) TenantEnable added in v0.4.0

func (p *Plugin) TenantEnable(t *EnableTenant)

func (*Plugin) Upgrade added in v1.0.0

func (p *Plugin) Upgrade(installer *Installer)

type PluginProfile added in v1.0.0

type PluginProfile struct {
	PluginID string                   `json:"plugin_id"`
	Profiles map[string]ProfileSchema `json:"profiles"`
}

type PluginProxyRouteMap

type PluginProxyRouteMap map[string]*PluginRoute

func (*PluginProxyRouteMap) String

func (pprm *PluginProxyRouteMap) String() string

type PluginRepo added in v0.3.0

type PluginRepo struct {
	*repository.Info `json:",inline"`
	UpsertTimestamp  int64  `json:"upsert_timestamp,omitempty"` // last upsert time stamp.
	Version          string `json:"version,omitempty"`          // model version.
}

func NewPluginRepo added in v0.3.0

func NewPluginRepo(i *repository.Info) *PluginRepo

func (*PluginRepo) String added in v0.3.0

func (pr *PluginRepo) String() string

type PluginRepoMap added in v0.3.0

type PluginRepoMap map[string]*PluginRepo

func (*PluginRepoMap) String added in v0.3.0

func (pprm *PluginRepoMap) String() string

type PluginRoute

type PluginRoute struct {
	ID                string                  `json:"id,omitempty"`                 // plugin id.
	Status            openapi_v1.PluginStatus `json:"status,omitempty"`             // plugin latest status.
	TkeelVersion      string                  `json:"tkeel_version,omitempty"`      // plugin depened tkeel version.
	RegisterAddons    map[string]string       `json:"register_addons,omitempty"`    // plugin register addons route map.
	ImplementedPlugin []string                `json:"implemented_plugin,omitempty"` // plugin implemented plugins.
	Version           string                  `json:"version,omitempty"`            // model version.
}

func NewPluginRoute

func NewPluginRoute(resp *openapi_v1.IdentifyResponse) *PluginRoute

func (*PluginRoute) Clone

func (pr *PluginRoute) Clone() *PluginRoute

func (*PluginRoute) String

func (pr *PluginRoute) String() string

type ProfileSchema added in v1.0.0

type ProfileSchema struct {
	Type        string `json:"type"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Default     int32  `json:"default"`
	MultipleOf  int32  `json:"multipleOf"`
	Minimum     int32  `json:"minimum"`
	Maximum     int32  `json:"maximum"`
}

nolint

type ProfileSchemas added in v1.0.0

type ProfileSchemas map[string]ProfileSchema

type Role added in v0.4.0

type Role struct {
	TenantID       string   `json:"tenant_id"`
	Name           string   `json:"name"`
	Desc           string   `json:"desc"`
	PermissionPath []string `json:"permission_path"`
}

type Secret added in v0.3.0

type Secret struct {
	Data string `json:"data,omitempty"` // data.
}

type User added in v0.3.0

type User struct {
	User   string `form:"user"`
	Tenant string `form:"tenant"`
	Role   string `form:"role"`
}

func (*User) Base64Decode added in v0.3.0

func (u *User) Base64Decode(s string) error

func (*User) Base64Encode added in v0.3.0

func (u *User) Base64Encode() string

Directories

Path Synopsis
TODO: all plugins.
TODO: all plugins.

Jump to

Keyboard shortcuts

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