user

package
v0.0.0-...-71876dc Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEPLOY_APPLY  = 1001 // 填写上线单
	DEPLOY_VIEW   = 1002 // 查看上线单
	DEPLOY_AUDIT  = 1003 // 审核上线单
	DEPLOY_DEPLOY = 1004 // 上线操作
	DEPLOY_DROP   = 1005 // 废弃上线单
	DEPLOY_EDIT   = 1006 // 编辑上线单

	PROJECT_SPACE_VIEW = 2001 // 查看空间
	PROJECT_SPACE_NEW  = 2002 // 新增空间
	PROJECT_SPACE_EDIT = 2003 // 编辑空间
	PROJECT_SPACE_DEL  = 2004 // 删除空间
	PROJECT_USER_VIEW  = 2100 // 查看成员
	PROJECT_USER_NEW   = 2101 // 新增成员
	PROJECT_USER_DEL   = 2102 // 删除成员
	PROJECT_VIEW       = 2201 // 查看项目
	PROJECT_NEW        = 2202 // 新增项目
	PROJECT_EDIT       = 2203 // 编辑项目
	PROJECT_DEL        = 2204 // 删除项目
	PROJECT_AUDIT      = 2205 // 启用项目
	PROJECT_BUILD      = 2206 // 构建设置
	PROJECT_HOOK       = 2207 // Hook设置

	USER_ROLE_VIEW = 3001 // 查看角色
	USER_ROLE_NEW  = 3002 // 新增角色
	USER_ROLE_EDIT = 3003 // 编辑角色
	USER_ROLE_DEL  = 3004 // 删除角色
	USER_VIEW      = 3101 // 查看用户
	USER_NEW       = 3102 // 新增用户
	USER_EDIT      = 3103 // 编辑用户
	USER_DEL       = 3104 // 删除用户

	SERVER_GROUP_VIEW = 4001 // 查看集群
	SERVER_GROUP_NEW  = 4002 // 新增集群
	SERVER_GROUP_EDIT = 4003 // 编辑集群
	SERVER_GROUP_DEL  = 4004 // 删除集群
	SERVER_VIEW       = 4101 // 查看服务器
	SERVER_NEW        = 4102 // 新增服务器
	SERVER_EDIT       = 4103 // 编辑服务器
	SERVER_DEL        = 4104 // 删除服务器
)

Variables

View Source
var PrivList = []PrivGroup{
	privProject, privUser, privServer, privDeploy,
}

Functions

func CheckHavePriv

func CheckHavePriv(api string, priv []int) bool

func PrivIn

func PrivIn(privCode int, privList []int) bool

func RoleGetMapByIds

func RoleGetMapByIds(ids []int) (map[int]Role, error)

Types

type Login

type Login struct {
	UserId   int
	RoleId   int
	Username string
	Password string
	Email    string
	Truename string
	Mobile   string
	Token    string
}

func (*Login) Login

func (login *Login) Login() error

func (*Login) Logout

func (login *Login) Logout() error

func (*Login) ValidateToken

func (login *Login) ValidateToken() error

type PrivGroup

type PrivGroup struct {
	Label string     `json:"label"`
	Items []PrivItem `json:"items"`
}

type PrivItem

type PrivItem struct {
	Label string `json:"label"`
	Value int    `json:"value"`
}

type Role

type Role struct {
	ID        int    `json:"id"`
	Name      string `json:"name"`
	Privilege []int  `json:"privilege"`
	Ctime     int    `json:"ctime"`
}

func (*Role) CreateOrUpdate

func (r *Role) CreateOrUpdate() error

func (*Role) Delete

func (r *Role) Delete() error

func (*Role) Detail

func (r *Role) Detail() error

func (*Role) List

func (r *Role) List(keyword string, offset, limit int) ([]Role, error)

func (*Role) Total

func (r *Role) Total(keyword string) (int, error)

type Token

type Token struct {
	ID     int
	UserId int
	Token  string
	Expire int
}

func (*Token) CreateOrUpdate

func (t *Token) CreateOrUpdate() error

func (*Token) DeleteByUserId

func (t *Token) DeleteByUserId() error

func (*Token) ValidateToken

func (t *Token) ValidateToken() bool

type User

type User struct {
	ID            int    `json:"id"`
	RoleId        int    `json:"role_id"`
	RoleName      string `json:"role_name"`
	Username      string `json:"username"`
	Password      string `json:"password"`
	Salt          string `json:"salt"`
	Email         string `json:"email"`
	Truename      string `json:"truename"`
	Mobile        string `json:"mobile"`
	Status        int    `json:"status"`
	LastLoginTime int    `json:"last_login_time"`
	LastLoginIp   string `json:"last_login_ip"`
	Ctime         int    `json:"ctime"`
}

func UserGetListByIds

func UserGetListByIds(userIds []int) ([]User, error)

func (*User) CreateOrUpdate

func (u *User) CreateOrUpdate() error

func (*User) Delete

func (u *User) Delete() error

func (*User) Detail

func (u *User) Detail() error

func (*User) Exists

func (u *User) Exists() (bool, error)

func (*User) List

func (u *User) List(keyword string, offset, limit int) ([]User, error)

func (*User) Total

func (u *User) Total(keyword string) (int, error)

func (*User) UpdatePassword

func (u *User) UpdatePassword() error

func (*User) UserCheckExists

func (u *User) UserCheckExists() (bool, error)

func (*User) UserSettingUpdate

func (u *User) UserSettingUpdate() error

Jump to

Keyboard shortcuts

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