Documentation
¶
Index ¶
- Variables
- func InitAsynqScheduler(c config.RedisConf) *asynq.Scheduler
- func InitAsynqServer(c config.RedisConf) *asynq.Server
- func InitRedisClient(c config.RedisConf) (redisClient *redis.Client)
- func InitWeworkCorpAPIUserManager(c config.WeworkConf) *api.CorpAPI
- func NewVolcIAMSvc(c config.VolcConf) (iamSvc *iam.IAM)
- type CPlusModel
- type ClearUserDetail
- type Depart
- type DepartsMsg
- type FetchLdapResp
- type LdapUser
- type Msg
- type ProjectField
- type RoleField
- type RoleResp
- type TokenResp
- type User
- type UserDetails
- type UserFields
- type UserResp
- type UsersMsg
- type VolcUserModel
- type WeworkUserModel
- type WeworkUserSyncRecords
- type WeworkUserSyncRecordsModel
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = sqlx.ErrNotFound
Functions ¶
func InitAsynqScheduler ¶
InitAsynqScheduler 初始化定时任务 asynq client scheduler 用来注册定时任务送入队列
func InitAsynqServer ¶
InitAsynqServer 初始化定时任务 asynq server 用来启动 worker 处理任务
func InitRedisClient ¶
InitRedisClient 初始化redis客户端
func InitWeworkCorpAPIUserManager ¶
func InitWeworkCorpAPIUserManager(c config.WeworkConf) *api.CorpAPI
InitWeworkCorpAPIUserManager 初始化企业微信 通讯录管理应用api
Types ¶
type CPlusModel ¶
type CPlusModel interface {
// GetUser 根据真实姓名、登录名查询用户
GetUser(name, eid string) (user UserFields, err error)
// SyncLdapUser 同步LDAP用户
SyncLdapUser() (err error)
// CacheProject 缓存所有c7n项目
CacheProject() (err error)
// GetProject 查询项目
GetProject(projectName string) (projectField ProjectField, err error)
// CacheRole 缓存角色
CacheRole() (err error)
// GetRole 查询角色
GetRole(roleName string) (id string, err error)
// AssignUserProjectRole 为c7n用户分配某项目的某角色
AssignUserProjectRole(c7nPid int64, c7nUid string, c7nRids []string) (err error)
// UnlockUser 解锁c7n用户
UnlockUser(c7nUid string) (err error)
}
func NewCPlusModel ¶
func NewCPlusModel(c config.Config) CPlusModel
type ClearUserDetail ¶
type ClearUserDetail struct {
Uid string `json:"userid"`
Name string `json:"name"`
Mobile string `json:"mobile"`
Position string `json:"position"`
Gender string `json:"gender"`
Email string `json:"email"`
Status int `json:"status"`
IsLeaderInDept []int `json:"is_leader_in_dept"`
MainDepartment int `json:"main_department"`
Department []int `json:"department"`
Order []int `json:"weOrder"`
Eid string `json:"eid"`
ExpireDate string `json:"expireDate"`
}
ClearUserDetail 清晰用户信息
func ParseWeworkUser ¶
func ParseWeworkUser(raw map[string]interface{}) (user *ClearUserDetail, err error)
ParseWeworkUser 解析企业微信用户
type Depart ¶
type Depart struct {
Id int `json:"id"`
Name string `json:"name"`
Order int `json:"weOrder"`
Parentid int `json:"parentid"`
}
Depart 部门
type DepartsMsg ¶
type DepartsMsg struct {
Department []Depart `json:"department"`
Errcode int `json:"errcode"`
Errmsg string `json:"errmsg"`
}
DepartsMsg 获取部门列表消息
type FetchLdapResp ¶
FetchLdapResp 查询ldap连接接口返回结构体
type LdapUser ¶
type LdapUser struct {
Num string `json:"num"`
Sam string `json:"sam"`
DisplayName string `json:"displayName"`
Phone string `json:"phone"`
WeworkDepartId int `json:"weworkDepartId"`
Email string `json:"email"`
WeworkExpire string `json:"weworkExpire"`
TagID int `json:"tagid"`
}
LdapUser ldap用户属性
type ProjectField ¶
type ProjectField struct {
Name string `json:"name"`
Code string `json:"code"`
ID int64 `json:"id"`
Enabled bool `json:"enabled"`
CreationDate string `json:"creationDate"`
CreatedBy int64 `json:"createdBy"`
LastUpdateDate string `json:"lastUpdateDate"`
LastUpdatedBy int64 `json:"lastUpdatedBy"`
}
ProjectField 项目字段
type RoleField ¶
type RoleField struct {
ID string `json:"id"`
Code string `json:"code"`
Assignable bool `json:"assignable"`
Enabled bool `json:"enabled"`
Name string `json:"name"`
TplRoleName string `json:"tplRoleName"`
RoleLevel string `json:"roleLevel"`
}
RoleField 角色字段
type RoleResp ¶
type RoleResp struct {
TotalPages int `json:"totalPages"`
TotalElements int `json:"totalElements"`
NumberOfElements int `json:"numberOfElements"`
Size int `json:"size"`
Number int `json:"number"`
Content []RoleField `json:"content"`
Empty bool `json:"empty"`
}
RoleResp 查询用户接口返回结构体
type TokenResp ¶
type TokenResp struct {
// 正确时候
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int64 `json:"expires_in"`
// 错误时候
Error string `json:"error"`
ErrorDescription string `json:"error_description"`
}
TokenResp 获取token接口返回数据结构体
type UserDetails ¶
type UserDetails struct {
Errcode int `json:"errcode"`
Errmsg string `json:"errmsg"`
Uid string `json:"userid"`
Name string `json:"name"`
Mobile string `json:"mobile"`
Position string `json:"position"`
Gender string `json:"gender"`
Email string `json:"email"`
Status int `json:"status"`
IsLeaderInDept []int `json:"is_leader_in_dept"`
MainDepartment int `json:"main_department"`
Department []int `json:"department"`
Order []int `json:"weOrder"`
Extattr struct {
Attrs []struct {
Type int `json:"type"`
Name string `json:"name"`
Text struct {
Value string `json:"value"`
} `json:"text"`
Value string `json:"value"`
} `json:"attrs"`
} `json:"extattr"`
}
UserDetails 用户
type UserFields ¶
type UserFields struct {
ID string `json:"id"`
LoginName string `json:"loginName"`
Name string `json:"realName"`
Phone string `json:"phone"`
Email string `json:"email"`
Password string `json:"password"`
OrgID string `json:"organizationId"`
Enabled bool `json:"enabled"`
Locked bool `json:"locked"`
Ldap bool `json:"ldap"`
Admin bool `json:"admin"`
}
UserFields 用户字段
type UserResp ¶
type UserResp struct {
TotalPages int64 `json:"totalPages"`
TotalElements int64 `json:"totalElements"`
NumberOfElements int64 `json:"numberOfElements"`
Size int64 `json:"size"`
Number int64 `json:"number"`
Content []UserFields `json:"content"`
Empty bool `json:"empty"`
}
UserResp 查询用户接口返回结构体
type UsersMsg ¶
type UsersMsg struct {
UserList []User `json:"userlist"`
Errcode int `json:"errcode"`
Errmsg string `json:"errmsg"`
}
UsersMsg 获取用户列表消息
type VolcUserModel ¶
type VolcUserModel interface {
// AddVolcUser 新增
AddVolcUser(userName, displayName, mobilePhone, email, pwd string) (resp *iam.CreateLoginProfileResp, err error)
// DelVolcUser 删除
DelVolcUser(userName string) (err error)
// GetVolcUser 获取用户
GetVolcUser(userName string) (resp *iam.UserResp, err error)
}
func NewVolcUserModel ¶
func NewVolcUserModel(c config.Config) VolcUserModel
type WeworkUserModel ¶
type WeworkUserModel interface {
// CacheSingleUser 缓存单个企业微信用户
CacheSingleUser(uid string) (err error)
// CacheAllUser 缓存所有企业微信用户
CacheAllUser() (err error)
// GetUser 获取
GetUser(name, eid string) (userDetail *ClearUserDetail, err error)
// AddUser 新增
AddUser(user *LdapUser) (err error)
// DisableUser 禁用
DisableUser(uid, name, eid string) (err error)
// EnableUser 启用
EnableUser(uid, name, eid string) (err error)
// DelUser 删除
DelUser(uid, name, eid string) (err error)
// Renewal 续期
Renewal(uid, eid, expireDate string) (err error)
// RemoveUserExpireFlag 清空用户过期字段
RemoveUserExpireFlag(uid, name, eid string) (err error)
// GetDepart 根据名称获取部门id
GetDepart(hrDepartName string) (depart Depart, err error)
}
func NewWeworkUserModel ¶
func NewWeworkUserModel(c config.Config) WeworkUserModel
type WeworkUserSyncRecords ¶
type WeworkUserSyncRecords struct {
Id int64 `db:"id"`
CreatedAt sql.NullTime `db:"created_at"`
UpdatedAt sql.NullTime `db:"updated_at"`
DeletedAt sql.NullTime `db:"deleted_at"`
Uid string `db:"uid"` // 用户ID
Name string `db:"name"` // 真实姓名
Eid string `db:"eid"` // 工号
SyncKind string `db:"sync_kind"` // 类别
}
type WeworkUserSyncRecordsModel ¶
type WeworkUserSyncRecordsModel interface {
// contains filtered or unexported methods
}
WeworkUserSyncRecordsModel is an interface to be customized, add more methods here, and implement the added methods in customWeworkUserSyncRecordsModel.
func NewWeworkUserSyncRecordsModel ¶
func NewWeworkUserSyncRecordsModel(conn sqlx.SqlConn, c cache.CacheConf) WeworkUserSyncRecordsModel
NewWeworkUserSyncRecordsModel returns a model for the database table.