Documentation ¶
Index ¶
Constants ¶
Variables ¶
View Source
var (
ByUid = By(func(p1, p2 *Staff) bool {
return p1.Uid < p2.Uid
})
)
View Source
var (
EmptyGroup = &Group{"", "", make([]string, 0)}
)
View Source
var ( // ProfileEditables deprecated ProfileEditables = map[string]string{ "nickname": "displayName", "cn": "cn", "gn": "givenName", "sn": "sn", "email": "mail", "mobile": "mobile", "eid": "employeeNumber", "etitle": "employeeType", "birthday": "dateOfBirth", "gender": "gender", "avatarPath": "avatarPath", "description": "description", } )
View Source
var (
VerifyLifeSeconds = 86400
)
Functions ¶
func SetNameFormat ¶
func SetNameFormat(s string)
Types ¶
type Authenticator ¶
type Authenticator interface { // Authenticate with uid and password Authenticate(uid, password string) (*Staff, error) }
Authenticator for Authenticate
type Group ¶
type GroupStore ¶
type GroupStore interface { AllGroup() ([]Group, error) GetGroup(name string) (*Group, error) SaveGroup(group *Group) error EraseGroup(name string) error }
GroupStore Storage for Group
type PasswordStore ¶
type PasswordStore interface { // Change password by self PasswordChange(uid, oldPassword, newPassword string) error // Reset password by administrator PasswordReset(uid, newPassword string) error }
PasswordStore Storage for Password
type Staff ¶
type Staff struct { Uid string `json:"uid" form:"uid" binding:"required"` // 登录名 CommonName string `json:"cn,omitempty" form:"cn"` // 姓名(全名) GivenName string `json:"gn" form:"gn" binding:"required"` // 名 FirstName Surname string `json:"sn" form:"sn" binding:"required"` // 姓 LastName Nickname string `json:"nickname,omitempty" form:"nickname"` // 昵称 Birthday string `json:"birthday,omitempty" form:"birthday"` // 生日 Gender Gender `json:"gender,omitempty" form:"gender"` // 性别 Email string `json:"email" form:"email" binding:"required"` // 邮箱 Mobile string `json:"mobile" form:"mobile" binding:"required"` // 手机 Tel string `json:"tel,omitempty" form:"tel"` // 座机 EmployeeNumber int `json:"eid,omitempty" form:"eid"` // 员工编号 EmployeeType string `json:"etype,omitempty" form:"etitle"` // 员工岗位 AvatarPath string `json:"avatarPath,omitempty" form:"avatar"` // 头像 JpegPhoto []byte `json:"-" form:"-"` // jpegPhoto data Description string `json:"description,omitempty" form:"description"` // 描述 JoinDate string `json:"joinDate,omitempty" form:"joinDate"` // 加入日期 IDCN string `json:"idcn,omitempty" form:"idcn"` // 身份证号 Created *time.Time `json:"created,omitempty" form:"created"` // 创建时间 Updated *time.Time `json:"updated,omitempty" form:"updated"` // 修改时间 DN string `json:"-" form:"-"` // distinguishedName of LDAP entry Leader bool `json:"leader,omitempty" form:"-"` // temporary var TeamID int `json:"teamID,omitempty" form:"-"` // department id Watchings []string `json:"watching,omitempty" form:"-"` // watchings }
employment for a person
func (*Staff) GetCommonName ¶
type StaffStore ¶
type StaffStore interface { // All browse from store, like LDAP All() Staffs // Get with uid Get(uid string) (*Staff, error) // GetByDN with dn GetByDN(dn string) (*Staff, error) // Delete with uid Delete(uid string) error // Save add or update Save(staff *Staff) (isNew bool, err error) // ModifyBySelf update by self ModifyBySelf(uid, password string, staff *Staff) error }
StaffStore Storage for Staff
type Verify ¶
type Verify struct { Id int `db:"id" json:"id"` Uid string `db:"uid" json:"uid"` Target string `db:"target" json:"target"` Type common.AliasType `db:"type_id" json:"type"` CodeHash int64 `db:"code_hash" json:"-"` LifeSeconds int `db:"life_seconds" json:"life_seconds"` Created time.Time `db:"created" json:"created"` Updated time.Time `db:"updated" json:"updated"` Code string `db:"-" json:"-"` }
用户验证,如邮箱、手机等
func (*Verify) CodeHashBytes ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.