Documentation ¶
Index ¶
- Variables
- func HashCode(code string) int64
- func MarkdownSanitize(s string) template.HTML
- func SanitizeTitle(s string) template.HTML
- func SetNameFormat(s string)
- func SplitName(cn string) (sn, gn string)
- type Article
- type Authenticator
- type By
- type Client
- type Gender
- type Group
- type GroupStore
- type Link
- type PasswordStore
- type Scope
- type Staff
- type StaffStore
- type Verify
Constants ¶
This section is empty.
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 (
ErrInvalidGender = errors.New("Invalid Gender value")
)
View Source
var (
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 MarkdownSanitize ¶
func SanitizeTitle ¶
func SetNameFormat ¶
func SetNameFormat(s string)
Types ¶
type Article ¶
type Article struct { Id int `sql:"id,pk" json:"id" form:"id"` Title string `sql:"title,notnull" json:"title" form:"title" binding:"required"` Content string `sql:"content,notnull" json:"content" form:"content" binding:"required"` Author string `sql:"author" json:"author"` Created time.Time `sql:"created" json:"created"` Updated time.Time `sql:"updated,nullempty" json:"updated,omitempty"` }
func (*Article) HtmlContent ¶
type Authenticator ¶
type Authenticator interface { // Authenticate with uid and password Authenticate(uid, password string) error }
Authenticator
type Client ¶
type Client struct { Id uint `json:"_id,omitempty"` Name string `json:"name"` Code string `json:"code,omitempty"` Secret string `json:"-"` RedirectUri string `json:"uri"` UserData interface{} `json:"-"` CreatedAt time.Time `json:"created,omitempty"` AllowedGrantTypes []string `json:"grant_types,omitempty"` AllowedResponseTypes []string `json:"response_types,omitempty"` AllowedScopes []string `json:"scopes,omitempty"` }
func (*Client) GetRedirectUri ¶
func (*Client) GetUserData ¶
func (c *Client) GetUserData() interface{}
type Group ¶
type GroupStore ¶
type GroupStore interface { AllGroup() []Group GetGroup(name string) (*Group, error) SaveGroup(*Group) error }
Storage for Group
type Link ¶
type Link struct { Id int `sql:"id,pk" json:"id" form:"id"` Title string `sql:"title,notnull" json:"title" form:"title" binding:"required"` Url template.URL `sql:"url,unique,notnull" json:"url" form:"url" binding:"required"` Position int `sql:"position" json:"position" form:"position"` Author string `sql:"author" json:"author"` Created time.Time `sql:"created" json:"created"` }
type PasswordStore ¶
type PasswordStore interface { // Change password by self PasswordChange(uid, old_password, new_password string) error // Reset password by administrator PasswordReset(uid, new_password string) error }
Storage for Password
type Staff ¶
type Staff struct { Uid string `json:"uid" form:"uid" binding:"required"` // 登录名 Passwd string `json:"-" form:"password"` // 密码 CommonName string `json:"cn,omitempty" form:"cn" binding:"required"` // 姓名(全名) 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 string `json:"eid,omitempty" form:"eid"` // 员工编号 EmployeeType string `json:"etype,omitempty" form:"etitle"` // 员工岗位 AvatarPath string `json:"avatarPath,omitempty" form:"avatar"` // 头像 Description string `json:"description,omitempty" form:"description"` // 描述 }
employment for a person
func (*Staff) GetCommonName ¶
type StaffStore ¶
type StaffStore interface { // All browse from store, like LDAP All() []*Staff // Get with uid Get(uid 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 }
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.