models

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodAll                = "*"
	KindResource             = "resource"
	UserKind     SubjectKind = "user"
	GroupKind    SubjectKind = "group"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	ID       uint   `gorm:"primarykey"      json:"id"`
	Name     string `gorm:"column:name"     json:"name"`
	Action   string `gorm:"column:action"   json:"action"`
	Resource string `gorm:"column:resource" json:"resource"`
	Scope    int    `gorm:"column:scope"    json:"scope"`

	RoleActionBindings []RoleActionBinding `gorm:"foreignKey:ActionID;constraint:OnDelete:CASCADE;" json:"-"`
}

func (Action) TableName

func (Action) TableName() string

type CollaborationInstance

type CollaborationInstance struct {
	ID                primitive.ObjectID `bson:"_id,omitempty"            json:"id,omitempty"`
	ProjectName       string             `bson:"project_name"             json:"project_name"`
	CreateTime        int64              `bson:"create_time"              json:"create_time"`
	UpdateTime        int64              `bson:"update_time"              json:"update_time"`
	LastVisitTime     int64              `bson:"last_visit_time"          json:"last_visit_time"`
	CollaborationName string             `bson:"collaboration_name"       json:"collaboration_name"`
	RecycleDay        int64              `bson:"recycle_day"              json:"recycle_day"`
	Revision          int64              `bson:"revision"                 json:"revision"`
	UserUID           string             `bson:"user_uid"                 json:"user_uid"`
	PolicyName        string             `bson:"policy_name"              json:"policy_name"`
	Workflows         []WorkflowCIItem   `bson:"workflows"                json:"workflows"`
	Products          []ProductCIItem    `bson:"products"                 json:"products"`
}

func (CollaborationInstance) TableName

func (CollaborationInstance) TableName() string

type CollaborationMode

type CollaborationMode struct {
	ID primitive.ObjectID `bson:"_id,omitempty"             json:"id,omitempty"`
	//foreign key:template_product/product_name
	ProjectName string           `bson:"project_name"              json:"project_name"`
	CreateTime  int64            `bson:"create_time"               json:"create_time"`
	UpdateTime  int64            `bson:"update_time"               json:"update_time"`
	Name        string           `bson:"name"                      json:"name"`
	Revision    int64            `bson:"revision"                  json:"revision"`
	Members     []string         `bson:"members"                   json:"members"`
	IsDeleted   bool             `bson:"is_deleted"                json:"is_deleted"`
	DeployType  string           `bson:"deploy_type"               json:"deploy_type"`
	RecycleDay  int64            `bson:"recycle_day"               json:"recycle_day"`
	Workflows   []WorkflowCMItem `bson:"workflows"                 json:"workflows" `
	Products    []ProductCMItem  `bson:"products"                  json:"products"`
	CreateBy    string           `bson:"create_by"                 json:"create_by"`
	UpdateBy    string           `bson:"update_by"                 json:"update_by"`
}

func (CollaborationMode) TableName

func (CollaborationMode) TableName() string

type CollaborationType

type CollaborationType string
const (
	CollaborationShare CollaborationType = "share"
	CollaborationNew   CollaborationType = "new"
)

type Connector

type Connector struct {
	ID                string `json:"id"`
	Type              string `json:"type"`
	Name              string `json:"name"`
	ResourceVersion   string `json:"resource_version"`
	Config            string `json:"config"`
	EnableLogOut      bool   `json:"enable_logout"`
	LogoutRedirectURL string `json:"logout_redirect_url"`
}

func (Connector) TableName

func (Connector) TableName() string

TableName sets the insert table name for this struct type

type GroupBinding

type GroupBinding struct {
	ID      int64  `gorm:"primary"         json:"id"`
	GroupID string `gorm:"column:group_id" json:"group_id"`
	UID     string `gorm:"column:uid"      json:"uid"`
}

func (GroupBinding) TableName

func (GroupBinding) TableName() string

TableName sets the insert table name for this struct type

type GroupRoleBinding

type GroupRoleBinding struct {
	ID      uint   `gorm:"primary"         json:"id"`
	GroupID string `gorm:"column:group_id" json:"group_id"`
	RoleID  uint   `gorm:"column:role_id"  json:"role_id"`
}

func (GroupRoleBinding) TableName

func (GroupRoleBinding) TableName() string

type MatchAttribute

type MatchAttribute struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Model

type Model struct {
	CreatedAt int64 `json:"created_at"`
	UpdatedAt int64 `json:"updated_at"`
}

type NewRole

type NewRole struct {
	ID          uint   `gorm:"primarykey"         json:"id"`
	Name        string `gorm:"column:name"        json:"name"`
	Description string `gorm:"column:description" json:"description"`
	Type        int64  `gorm:"column:type"        json:"type"`
	Namespace   string `gorm:"column:namespace"   json:"namespace"`

	RoleActionBindings []RoleActionBinding `gorm:"foreignKey:RoleID;constraint:OnDelete:CASCADE;" json:"-"`
	RoleUserBindings   []NewRoleBinding    `gorm:"foreignKey:RoleID;constraint:OnDelete:CASCADE;" json:"-"`
	GroupRoleBindings  []GroupRoleBinding  `gorm:"foreignKey:RoleID;constraint:OnDelete:CASCADE;" json:"-"`
}

NewRole is the schema for role in mysql database, after version 1.7

func (NewRole) TableName

func (NewRole) TableName() string

type NewRoleBinding

type NewRoleBinding struct {
	ID     uint   `gorm:"primary" json:"id"`
	UID    string `gorm:"column:uid" json:"uid"`
	RoleID uint   `gorm:"column:role_id" json:"role_id"`
}

NewRoleBinding is the structure for role binding in mysql, after version 1.7

func (NewRoleBinding) TableName

func (NewRoleBinding) TableName() string

type ProductCIItem

type ProductCIItem struct {
	Name              string            `bson:"name"               json:"name"`
	BaseName          string            `bson:"base_name"          json:"base_name"`
	CollaborationType CollaborationType `bson:"collaboration_type" json:"collaboration_type"`
	RecycleDay        int64             `bson:"recycle_day"        json:"recycle_day"`
	Verbs             []string          `bson:"verbs"              json:"verbs"`
}

type ProductCMItem

type ProductCMItem struct {
	Name              string            `bson:"name" json:"name"`
	CollaborationType CollaborationType `bson:"collaboration_type" json:"collaboration_type"`
	RecycleDay        int64             `bson:"recycle_day" json:"recycle_day"`
	Verbs             []string          `bson:"verbs" json:"verbs"`
}

type Project

type Project struct {
	ProductName string `bson:"product_name"              json:"product_name"`
}

func (Project) TableName

func (Project) TableName() string

type Role

type Role struct {
	Name      string               `bson:"name"      json:"name"`
	Desc      string               `bson:"desc"      json:"desc"`
	Namespace string               `bson:"namespace" json:"namespace"`
	Rules     []*Rule              `bson:"rules"     json:"rules"`
	Type      setting.ResourceType `bson:"type"     json:"type"`
}

Role is a namespaced or cluster scoped, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. for a cluster scoped Role, namespace is empty.

func (Role) TableName

func (Role) TableName() string

type RoleActionBinding

type RoleActionBinding struct {
	ID       uint `gorm:"primarykey"        json:"id"`
	RoleID   uint `gorm:"column:role_id"    json:"role_id"`
	ActionID uint `gorm:"column:action_id"  json:"action_id"`
}

func (RoleActionBinding) TableName

func (RoleActionBinding) TableName() string

type RoleBinding

type RoleBinding struct {
	Name      string `bson:"name"      json:"name"`
	Namespace string `bson:"namespace" json:"namespace"`

	// Subjects holds references to the objects the role applies to.
	Subjects []*Subject `bson:"subjects" json:"subjects"`

	// RoleRef can reference a namespaced or cluster scoped Role.
	RoleRef *RoleRef `bson:"role_ref" json:"roleRef"`
}

RoleBinding references a role, but does not contain it. It adds who information via Subjects. RoleBindings in a given namespace only have effect in that namespace. for a cluster scoped RoleBinding, namespace is empty.

func (RoleBinding) TableName

func (RoleBinding) TableName() string

type RoleBindingDetail

type RoleBindingDetail struct {
	User *User
	Role *Role
}

RoleBindingDetail is the structure that has actual user info and role info details.

type RoleRef

type RoleRef struct {
	Name string `bson:"name" json:"name"`

	// Namespace of the referenced object. if the object is cluster scoped, namespace is empty.
	Namespace string `bson:"namespace" json:"namespace"`
}

RoleRef contains information that points to the role being used

type RoleTemplate added in v2.3.1

type RoleTemplate struct {
	ID          uint   `gorm:"primarykey"         json:"id"`
	Name        string `gorm:"column:name"        json:"name"`
	Description string `gorm:"column:description" json:"description"`
	Type        int    `gorm:"column:type" json:"type"`

	RoleTemplateActionBindings []RoleTemplateActionBinding `gorm:"foreignKey:RoleTemplateID;constraint:OnDelete:CASCADE;" json:"-"`
	RoleTemplateBindings       []RoleTemplateBinding       `gorm:"foreignKey:RoleTemplateID;constraint:OnDelete:CASCADE;" json:"-"`
}

func (RoleTemplate) TableName added in v2.3.1

func (RoleTemplate) TableName() string

type RoleTemplateActionBinding added in v2.3.1

type RoleTemplateActionBinding struct {
	ID             uint `gorm:"primarykey"        json:"id"`
	RoleTemplateID uint `gorm:"column:role_template_id"    json:"role_template_id"`
	ActionID       uint `gorm:"column:action_id"  json:"action_id"`
}

func (RoleTemplateActionBinding) TableName added in v2.3.1

func (RoleTemplateActionBinding) TableName() string

type RoleTemplateBinding added in v2.3.1

type RoleTemplateBinding struct {
	ID             uint `gorm:"primary"                      json:"id"`
	RoleID         uint `gorm:"column:role_id"               json:"role_id"`
	RoleTemplateID uint `gorm:"column:role_template_id"      json:"role_template_id"`
}

func (RoleTemplateBinding) TableName added in v2.3.1

func (RoleTemplateBinding) TableName() string

TableName sets the insert table name for this struct type

type Rule

type Rule struct {
	// Verbs is a list of http methods or resource actions that apply to ALL the Resources contained in this rule. '*' represents all methods.
	Verbs []string `bson:"verbs"         json:"verbs"`

	// Resources is a list of resources this rule applies to. '*' represents all resources.
	Resources       []string         `bson:"resources" json:"resources"`
	Kind            string           `bson:"kind"     json:"kind"`
	MatchAttributes []MatchAttribute `bson:"match_attributes" json:"match_attributes"`
}

Rule holds information that describes a policy rule, but does not contain information about whom the rule applies to. If Kind is "resource", verbs are resource actions, while resources are resource names

type Subject

type Subject struct {
	// Kind of object being referenced. allowed values are "User", "Group".
	Kind SubjectKind `bson:"kind" json:"kind"`
	// unique identifier of the object being referenced.
	UID string `bson:"uid" json:"uid"`
}

Subject contains a reference to the object or user identities a role binding applies to.

type SubjectKind

type SubjectKind string

type User

type User struct {
	Model
	UID          string `gorm:"primary" json:"uid"`
	Name         string `json:"name"`
	IdentityType string `gorm:"default:'unknown'" json:"identity_type"`
	Email        string `json:"email"`
	Phone        string `json:"phone"`
	Account      string `json:"account"`
	APIToken     string `gorm:"api_token" json:"api_token"`

	// used to mention the foreign key relationship between user and groupBinding
	// and specify the onDelete action.
	GroupBindings    []GroupBinding   `gorm:"foreignKey:UID;references:UID;constraint:OnDelete:CASCADE;" json:"-"`
	UserRoleBindings []NewRoleBinding `gorm:"foreignKey:UID;references:UID;constraint:OnDelete:CASCADE;" json:"-"`
}

func (User) TableName

func (User) TableName() string

TableName sets the insert table name for this struct type

type UserGroup

type UserGroup struct {
	Model
	GroupID     string `gorm:"column:group_id"    json:"group_id"`
	GroupName   string `gorm:"column:group_name"  json:"group_name"`
	Description string `gorm:"column:description" json:"description"`
	Type        int64  `gorm:"column:type"        json:"type"`
	// used to mention the foreign key relationship between userGroup and groupBinding
	// and specify the onDelete action.
	GroupBindings     []GroupBinding     `gorm:"foreignKey:GroupID;references:GroupID;constraint:OnDelete:CASCADE;" json:"-"`
	GroupRoleBindings []GroupRoleBinding `gorm:"foreignKey:GroupID;references:GroupID;constraint:OnDelete:CASCADE;" json:"-"`
}

func (UserGroup) TableName

func (UserGroup) TableName() string

TableName sets the insert table name for this struct type

type UserLogin

type UserLogin struct {
	Model
	UID           string `json:"uid"`
	Password      string `json:"password"`
	LastLoginTime int64  `json:"last_login_time"`
	LoginId       string `json:"login_id"`
	LoginType     int    `json:"login_type"`
}

func (UserLogin) TableName

func (UserLogin) TableName() string

TableName sets the insert table name for this struct type

type UserSetting

type UserSetting struct {
	ID           primitive.ObjectID `bson:"_id,omitempty"      json:"id,omitempty"`
	UID          string             `bson:"uid"                json:"uid"`
	Theme        string             `bson:"theme"              json:"theme"`
	LogBgColor   string             `bson:"log_bg_color"       json:"log_bg_color"`
	LogFontColor string             `bson:"log_font_color"     json:"log_font_color"`
}

func (UserSetting) TableName

func (UserSetting) TableName() string

type WorkflowCIItem

type WorkflowCIItem struct {
	WorkflowType string `bson:"workflow_type" json:"workflow_type"`
	Name         string `bson:"name"               json:"name"`
	// workflow display name, it can be modified by users, so we don't save it.
	DisplayName       string            `bson:"-"                  json:"display_name"`
	BaseName          string            `bson:"base_name"          json:"base_name"`
	CollaborationType CollaborationType `bson:"collaboration_type" json:"collaboration_type"`
	Verbs             []string          `bson:"verbs"              json:"verbs"`
}

type WorkflowCMItem

type WorkflowCMItem struct {
	WorkflowType string `bson:"workflow_type" json:"workflow_type"`
	Name         string `bson:"name" json:"name"`
	// workflow display name, it can be modified by users, so we don't save it.
	DisplayName       string            `bson:"-"    json:"display_name"`
	CollaborationType CollaborationType `bson:"collaboration_type" json:"collaboration_type"`
	Verbs             []string          `bson:"verbs" json:"verbs"`
}

Jump to

Keyboard shortcuts

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