backends

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2019 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyVal = errors.New("empty value")

	ErrNotFound = errors.New("Not Found")

	ErrNoRows = sql.ErrNoRows
)
View Source
var (
	ErrInvalidResetToken = errors.New("invalid reset token or not found")
	ErrMailNotReady      = errors.New("email system is not ready")
)
View Source
var (
	MailSenderName = "Notification"

	BaseURL string
)
View Source
var (
	EmailDomain string
)
View Source
var (
	ErrStoreNotFound = ldap.ErrNotFound
)

Functions

func CheckMailUnseen

func CheckMailUnseen(uid string) int

func Cleanup

func Cleanup() (err error)

清理过期的数据

func GetEmailAddress

func GetEmailAddress(uid string) string

func GetMailEntryUrl

func GetMailEntryUrl(uid string) string

func GetStaffFromExmail

func GetStaffFromExmail(email string) (*models.Staff, error)

func GetStaffFromWechatUser added in v0.8.13

func GetStaffFromWechatUser(user *exwechat.User) *models.Staff

func LoadArticle

func LoadArticle(id int) (*content.Article, error)

func LoadArticles

func LoadArticles(limit, offset int) (data []*content.Article, err error)
func LoadLink(id int) (*content.Link, error)
func LoadLinks(limit, offset int) (data []*content.Link, err error)

func NextStaffID added in v0.8.2

func NextStaffID() (eid int, err error)

返回下一个员工ID

func SaveArticle

func SaveArticle(a *content.Article) error
func SaveLink(l *content.Link) error

func SetDSN added in v0.10.0

func SetDSN(dsn string)

func SetLDAP added in v0.10.0

func SetLDAP(c LDAPConfig)

func SetPasswordSecret added in v0.10.0

func SetPasswordSecret(s string)

func SetupSMTPAuth added in v0.9.0

func SetupSMTPAuth(from, password string)

func SetupSMTPHost added in v0.10.0

func SetupSMTPHost(host string, port int)

func WriteUserLog

func WriteUserLog(uid, subject, message string) error

Types

type DbStorage

type DbStorage struct {
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage() *DbStorage

func (*DbStorage) Clone

func (s *DbStorage) Clone() osin.Storage

func (*DbStorage) Close

func (s *DbStorage) Close()

func (*DbStorage) CountClients added in v0.6.3

func (s *DbStorage) CountClients() (total uint)

func (*DbStorage) GetClient

func (s *DbStorage) GetClient(id string) (osin.Client, error)

func (*DbStorage) GetClientWithCode added in v0.6.3

func (s *DbStorage) GetClientWithCode(code string) (c *oauth.Client, err error)

func (*DbStorage) GetClientWithID added in v0.9.0

func (s *DbStorage) GetClientWithID(id int) (c *oauth.Client, err error)

func (*DbStorage) IsAuthorized added in v0.6.3

func (s *DbStorage) IsAuthorized(clientId, username string) bool

func (*DbStorage) LoadAccess

func (s *DbStorage) LoadAccess(code string) (*osin.AccessData, error)

func (*DbStorage) LoadAuthorize

func (s *DbStorage) LoadAuthorize(code string) (*osin.AuthorizeData, error)

func (*DbStorage) LoadClients added in v0.6.3

func (s *DbStorage) LoadClients(spec *oauth.ClientSpec) (clients []oauth.Client, err error)

func (*DbStorage) LoadRefresh

func (s *DbStorage) LoadRefresh(code string) (*osin.AccessData, error)

func (*DbStorage) LoadScopes added in v0.6.3

func (s *DbStorage) LoadScopes() (scopes []oauth.Scope, err error)

func (*DbStorage) RemoveAccess

func (s *DbStorage) RemoveAccess(code string) error

func (*DbStorage) RemoveAuthorize

func (s *DbStorage) RemoveAuthorize(code string) error

func (*DbStorage) RemoveRefresh

func (s *DbStorage) RemoveRefresh(code string) error

func (*DbStorage) SaveAccess

func (s *DbStorage) SaveAccess(data *osin.AccessData) error

func (*DbStorage) SaveAuthorize

func (s *DbStorage) SaveAuthorize(data *osin.AuthorizeData) error

func (*DbStorage) SaveAuthorized added in v0.6.3

func (s *DbStorage) SaveAuthorized(clientId, username string) error

func (*DbStorage) SaveClient added in v0.6.3

func (s *DbStorage) SaveClient(client *oauth.Client) error

type LDAPConfig added in v0.10.0

type LDAPConfig = ldap.Config

type OSINStore added in v0.6.3

type OSINStore = oauth.OSINStore

type PoolStats added in v0.8.6

type PoolStats = ldap.PoolStats

type Servicer added in v0.6.3

type Servicer interface {
	models.Authenticator
	models.StaffStore
	models.PasswordStore
	models.GroupStore
	cas.TicketStore

	OSIN() OSINStore
	Ready() error
	CloseAll()

	SaveStaff(staff *models.Staff) error

	InGroup(gn, uid string) bool
	InGroupAny(uid string, names ...string) bool

	ProfileModify(uid, password string, staff *models.Staff) error

	PasswordForgot(at common.AliasType, target, uid string) error
	PasswordResetTokenVerify(token string) (uid string, err error)
	PasswordResetWithToken(login, token, passwd string) (err error)

	Team() weekly.TeamStore
	Weekly() weekly.WeeklyStore

	PoolStats() *PoolStats
}

func NewService

func NewService() Servicer

NewService return new Servicer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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