auditlogger

package
v0.0.0-...-9e48597 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	AUDIT_LOG_CREATE_APP = 1
	AUDIT_LOG_EDIT_APP   = 2
	AUDIT_LOG_DELETE_APP = 3
	AUDIT_LOG_VIEW_APP   = 4
	AUDIT_LOG_DEPLOY_APP = 5

	AUDIT_LOG_CREATE_RESOURCE = 6
	AUDIT_LOG_UPDATE_RESOURCE = 7
	AUDIT_LOG_DELETE_RESOURCE = 8

	AUDIT_LOG_RUN_ACTION = 9

	AUDIT_LOG_TRIGGER_TASK = 10
)
View Source
const KOZMO_DEPLOY_MODE_CLOUD = "cloud"
View Source
const RETRY_TIMES = 6
View Source
const (
	TASK_GENERATE_SQL = "sqlGenerate"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditLog

type AuditLog struct {
	ID           int       `gorm:"column:id;type:bigserial;primary_key"`
	UID          uuid.UUID `gorm:"column:uid;type:uuid;not null"`
	Type         int       `gorm:"column:type;type:smallint;not null"`
	CreatedAt    time.Time `gorm:"column:created_at;type:timestamp;not null"`
	BasicData    string    `gorm:"column:basic_data;type:jsonb;not null"`
	Context      string    `gorm:"column:context;type:jsonb;not null"`
	AppID        int       `gorm:"column:app_id;type:bigint"`
	AppName      string    `gorm:"column:app_name;type:varchar;size:255"`
	ResourceID   int       `gorm:"column:resource_id;type:bigint"`
	ResourceName string    `gorm:"column:resource_name;type:varchar;size: 255"`
	ActionID     int       `gorm:"column:action_id;type:bigint"`
	ActionName   string    `gorm:"column:action_name;type:varchar;size: 255"`
	UserID       int       `gorm:"column:user_id;type:bigint;not null"`
	Username     string    `gorm:"column:username;type:varchar;size:32;not null"`
	Email        string    `gorm:"column:email;type:varchar;size:255;not null"`
	Who          string    `gorm:"column:who;type:jsonb;not null"`
	TeamID       int       `gorm:"column:team_id;type:bigint;not null"`
	TeamName     string    `gorm:"column:team_name;type:varchar;size:255;not null"`
}

func (*AuditLog) TableName

func (*AuditLog) TableName() string

type AuditLogger

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

func GetInstance

func GetInstance() *AuditLogger

func (*AuditLogger) Log

func (a *AuditLogger) Log(logInfo *LogInfo)

type Config

type Config struct {
	Addr     string `env:"KOZMO_AUDIT_PG_ADDR" envDefault:"localhost"`
	Port     string `env:"KOZMO_AUDIT_PG_PORT" envDefault:"5432"`
	User     string `env:"KOZMO_AUDIT_PG_USER" envDefault:"kozmo_supervisor"`
	Password string `env:"KOZMO_AUDIT_PG_PASSWORD" envDefault:"71De5JllWSetLYU"`
	Database string `env:"KOZMO_AUDIT_PG_DATABASE" envDefault:"kozmo_supervisor"`
}

type LogInfo

type LogInfo struct {
	// event
	EventType int
	// team
	TeamID   int
	TeamName string
	// user
	UserID int
	// ip address
	IP string
	// app
	AppID   int
	AppName string
	// resource
	ResourceID   int
	ResourceName string
	ResourceType string
	// action
	ActionID        int
	ActionName      string
	ActionParameter interface{}
	// task
	TaskName  string
	TaskInput map[string]interface{}
}

type User

type User struct {
	ID             int       `gorm:"column:id;type:bigserial;primary_key;index:users_ukey"`
	UID            uuid.UUID `gorm:"column:uid;type:uuid;not null;index:users_ukey"`
	Nickname       string    `gorm:"column:nickname;type:varchar;size:15"`
	PasswordDigest string    `gorm:"column:password_digest;type:varchar;size:60;not null"`
	Email          string    `gorm:"column:email;type:varchar;size:255;not null"`
	Avatar         string    `gorm:"column:avatar;type:varchar;size:255;not null"`
	SSOConfig      string    `gorm:"column:sso_config;type:jsonb"`    // for single sign-on data
	Customization  string    `gorm:"column:customization;type:jsonb"` // for user itself customization config, including: Language, IsSubscribed
	CreatedAt      time.Time `gorm:"column:created_at;type:timestamp"`
	UpdatedAt      time.Time `gorm:"column:updated_at;type:timestamp"`
}

func (*User) TableName

func (*User) TableName() string

type UserInfo

type UserInfo struct {
	UserId            int       `json:"userId"`
	Username          string    `json:"username"`
	Email             string    `json:"email"`
	ConnectedToGithub bool      `json:"connectedToGithub"`
	HasPassword       bool      `json:"hasPassword"`
	PermissionType    int       `json:"permissionType"`
	JoinTeamAt        time.Time `json:"joinTeamAt,omitempty"`
}

type UserRole

type UserRole struct {
	UserRole  int
	CreatedAt time.Time
}

type UserSSOConfig

type UserSSOConfig struct {
	Github map[string]string `json:"github"`
}

Jump to

Keyboard shortcuts

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