Documentation
¶
Index ¶
- Constants
- type Action
- type CollaborationInstance
- type CollaborationMode
- type CollaborationType
- type Connector
- type GroupBinding
- type GroupRoleBinding
- type MatchAttribute
- type Model
- type NewRole
- type NewRoleBinding
- type ProductCIItem
- type ProductCMItem
- type Project
- type Role
- type RoleActionBinding
- type RoleBinding
- type RoleBindingDetail
- type RoleRef
- type Rule
- type Subject
- type SubjectKind
- type User
- type UserGroup
- type UserLogin
- type UserSetting
- type WorkflowCIItem
- type WorkflowCMItem
Constants ¶
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:"-"`
}
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 ( CollaborationNew CollaborationType = "new" )
type Connector ¶
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 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
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 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.
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 ¶
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 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:"-"`
}
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:"-"`
}
type UserLogin ¶
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"`
}