backends

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 28 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")
	ErrEmptyEmail        = errors.New("email is empty")
)
View Source
var (
	BaseURL string
)
View Source
var (
	ErrStoreNotFound = ldap.ErrNotFound
)

vars

View Source
var (
	ToJSONKV = oauth.ToJSONKV
)

vars

Functions

func Cleanup

func Cleanup() (err error)

Cleanup 清理过期的数据

func GenNewClient added in v0.12.0

func GenNewClient(name, redirectURI string) *oauth.Client

GenNewClient ...

func GenNewIID added in v0.12.0

func GenNewIID() string

GenNewIID ...

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)

NextStaffID 返回下一个员工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)

SetLDAP ...

func SetPasswordSecret added in v0.10.0

func SetPasswordSecret(s string)

func StoreTeamAndStaffs added in v0.12.0

func StoreTeamAndStaffs(svc Servicer, team *team.Team, staffs models.Staffs) (err error)

StoreTeamAndStaffs ...

func WriteUserLog

func WriteUserLog(uid, subject, message string) error

Types

type Client added in v0.12.0

type Client = oauth.Client

func NewClient added in v0.12.0

func NewClient(id, secret, redirectURI string) *Client

type ClientSpec added in v0.12.0

type ClientSpec = oauth.ClientSpec

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) (c osin.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) LoadClient added in v0.12.0

func (s *DbStorage) LoadClient(id string) (*Client, 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) RemoveClient added in v0.12.0

func (s *DbStorage) RemoveClient(id string) error

func (*DbStorage) RemoveRefresh

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

func (*DbStorage) SaveAccess

func (s *DbStorage) SaveAccess(data *osin.AccessData) (err 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 Group added in v0.10.7

type Group = schema.Group

Group ...

type JSONKV added in v0.12.0

type JSONKV = oauth.JSONKV

type LDAPConfig added in v0.10.0

type LDAPConfig = ldap.Config

LDAPConfig ...

type OSINStore added in v0.6.3

type OSINStore = oauth.OSINStore

type PoolStats added in v0.8.6

type PoolStats = ldap.PoolStats

PoolStats ...

type Servicer added in v0.6.3

type Servicer interface {
	schema.Authenticator
	schema.PeopleStore
	schema.PasswordStore
	schema.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() team.Store
	Watch() team.WatchStore
	Weekly() weekly.Store

	PoolStats() *PoolStats
}

Servicer ...

func NewService

func NewService() Servicer

NewService return new Servicer

type Spec added in v0.10.7

type Spec = schema.Spec

Spec ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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