syncd: github.com/dreamans/syncd/module/user Index | Files

package user

import "github.com/dreamans/syncd/module/user"

Index

Package Files

login.go priv.go role.go token.go user.go

Constants

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

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

func CheckHavePriv Uses

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

func PrivIn Uses

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

func RoleGetMapByIds Uses

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

type Login Uses

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

func (*Login) Login Uses

func (login *Login) Login() error

func (*Login) Logout Uses

func (login *Login) Logout() error

func (*Login) ValidateToken Uses

func (login *Login) ValidateToken() error

type PrivGroup Uses

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

type PrivItem Uses

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

type Role Uses

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

func (*Role) CreateOrUpdate Uses

func (r *Role) CreateOrUpdate() error

func (*Role) Delete Uses

func (r *Role) Delete() error

func (*Role) Detail Uses

func (r *Role) Detail() error

func (*Role) List Uses

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

func (*Role) Total Uses

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

type Token Uses

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

func (*Token) CreateOrUpdate Uses

func (t *Token) CreateOrUpdate() error

func (*Token) DeleteByUserId Uses

func (t *Token) DeleteByUserId() error

func (*Token) ValidateToken Uses

func (t *Token) ValidateToken() bool

type User Uses

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 Uses

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

func (*User) CreateOrUpdate Uses

func (u *User) CreateOrUpdate() error

func (*User) Delete Uses

func (u *User) Delete() error

func (*User) Detail Uses

func (u *User) Detail() error

func (*User) Exists Uses

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

func (*User) List Uses

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

func (*User) Total Uses

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

func (*User) UpdatePassword Uses

func (u *User) UpdatePassword() error

func (*User) UserCheckExists Uses

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

func (*User) UserSettingUpdate Uses

func (u *User) UserSettingUpdate() error

Package user imports 11 packages (graph) and is imported by 4 packages. Updated 2019-04-30. Refresh now. Tools for package owners.