Documentation ¶
Overview ¶
Nging is a toolbox for webmasters Copyright (C) 2018-present Wenhui Shen <swh@admpub.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Nging is a toolbox for webmasters Copyright (C) 2018-present Wenhui Shen <swh@admpub.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Nging is a toolbox for webmasters Copyright (C) 2018-present Wenhui Shen <swh@admpub.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Nging is a toolbox for webmasters Copyright (C) 2018-present Wenhui Shen <swh@admpub.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Nging is a toolbox for webmasters Copyright (C) 2018-present Wenhui Shen <swh@admpub.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Nging is a toolbox for webmasters Copyright (C) 2018-present Wenhui Shen <swh@admpub.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Nging is a toolbox for webmasters Copyright (C) 2018-present Wenhui Shen <swh@admpub.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Nging is a toolbox for webmasters Copyright (C) 2018-present Wenhui Shen <swh@admpub.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Nging is a toolbox for webmasters Copyright (C) 2018-present Wenhui Shen <swh@admpub.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Index ¶
- Constants
- Variables
- func AlertSend(ctx echo.Context, topic string, alertData *alertRegistry.AlertData) error
- func GetU2FStepCondValue(step uint) interface{}
- type AlertRecipient
- func (s *AlertRecipient) Add() (pk interface{}, err error)
- func (s *AlertRecipient) Delete(mw func(db.Result) db.Result, args ...interface{}) (err error)
- func (s *AlertRecipient) Edit(mw func(db.Result) db.Result, args ...interface{}) (err error)
- func (s *AlertRecipient) GetWithExt(mw func(db.Result) db.Result, args ...interface{}) (row *AlertRecipientExt, err error)
- type AlertRecipientExt
- type AlertTopic
- func (s *AlertTopic) Add(rows ...*dbschema.NgingAlertTopic) (pk interface{}, err error)
- func (s *AlertTopic) Edit(mw func(db.Result) db.Result, args ...interface{}) (err error)
- func (s *AlertTopic) Exists(topic string, recipientId uint) (bool, error)
- func (s *AlertTopic) ExistsOther(topic string, recipientId uint, excludeID uint) (bool, error)
- func (s *AlertTopic) Send(topic string, alertData *alert.AlertData) (err error)
- type AlertTopicExt
- type CloudBackup
- type CloudBackupExt
- type CloudStorage
- func (s *CloudStorage) Add() (pk interface{}, err error)
- func (s *CloudStorage) BaseURL() string
- func (s *CloudStorage) CachedList() map[string]*dbschema.NgingCloudStorage
- func (s *CloudStorage) Edit(mw func(db.Result) db.Result, args ...interface{}) (err error)
- func (s *CloudStorage) Get(mw func(db.Result) db.Result, args ...interface{}) error
- func (s *CloudStorage) RawSecret() string
- type Code
- func (c *Code) AddVerificationCode() (interface{}, error)
- func (c *Code) CheckFrequency(ownerID uint64, ownerType string, sendMethod string, frequencyCfg echo.H) error
- func (c *Code) CheckVerificationCode(code string, purpose string, ownerID uint64, ownerType string, ...) (err error)
- func (c *Code) CountTodayVerificationCode(ownerID uint64, ownerType string, sendMethod string) (int64, error)
- func (c *Code) LastVerificationCode(ownerID uint64, ownerType string, sendMethod string) (err error)
- func (c *Code) UseInvitationCode(m *dbschema.NgingCodeInvitation, usedUid uint) (err error)
- func (c *Code) UseVerificationCode(m *dbschema.NgingCodeVerification) (err error)
- func (c *Code) VerfyInvitationCode(code string) (err error)
- type Config
- func (f *Config) Add() (pk interface{}, err error)
- func (f *Config) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Config) EditByPK(mw func(db.Result) db.Result, group string, key string) error
- func (f *Config) ListAllMapByGroup() (echo.H, error)
- func (f *Config) ListByGroup(group string) (func() int64, error)
- func (f *Config) ListMapByGroup(group string) (echo.H, error)
- func (f *Config) Upsert() (pk interface{}, err error)
- func (f *Config) ValueByKey(group, key string) string
- type Invitation
- type Kv
- func (s *Kv) Add() (pk interface{}, err error)
- func (s *Kv) AutoCreateKey(key string, value ...string) error
- func (s *Kv) Delete(mw func(db.Result) db.Result, args ...interface{}) (err error)
- func (s *Kv) Edit(mw func(db.Result) db.Result, args ...interface{}) (err error)
- func (s *Kv) Get(mw func(db.Result) db.Result, args ...interface{}) error
- func (s *Kv) GetFromTypeList(typeList []*dbschema.NgingKv, key string) string
- func (s *Kv) GetTypeValues(typ string, defaultValue ...string) ([]string, error)
- func (s *Kv) GetValue(key string, defaultValue ...string) (string, error)
- func (s *Kv) IsRootType(typ string) bool
- func (s *Kv) KvTypeList(excludeIDs ...uint) []*dbschema.NgingKv
- func (s *Kv) ListByType(typ string, excludeIDs ...uint) []*dbschema.NgingKv
- func (s *Kv) ListToMap(typeList []*dbschema.NgingKv) map[string]*dbschema.NgingKv
- func (s *Kv) SetSingleField(id int, field string, value string) error
- type LoginLog
- func (s *LoginLog) Add() (pk interface{}, err error)
- func (s *LoginLog) AddAndSaveSession() (pk interface{}, err error)
- func (s *LoginLog) Edit(mw func(db.Result) db.Result, args ...interface{}) (err error)
- func (s *LoginLog) GetLastFailure(ownerType string, ownerId uint64) (err error)
- func (s *LoginLog) GetLastSuccess(ownerType string, ownerId uint64, sessionId string) (err error)
- func (s *LoginLog) InitLocation() (ipInfo ip2regionparser.IpInfo, err error)
- func (s *LoginLog) ListPage(cond *db.Compounds, sorts ...interface{}) ([]*dbschema.NgingLoginLog, error)
- type SendingLog
- type Task
- type TaskAndGroup
- type TaskGroup
- type TaskLog
- type User
- func (u *User) Add() (err error)
- func (u *User) CheckPasswd(username string, password string) (exists bool, err error)
- func (u *User) ClearPasswordData(users ...*dbschema.NgingUser) dbschema.NgingUser
- func (u *User) Exists(username string) (bool, error)
- func (u *User) Exists2(username string, excludeUID uint) (bool, error)
- func (u *User) FireLoginFailure(pass string, err error) error
- func (u *User) FireLoginSuccess() error
- func (u *User) GetUserAllU2F(uid uint) ([]*dbschema.NgingUserU2f, error)
- func (u *User) IncrLoginFails() error
- func (u *User) NeedCheckU2F(uid uint, step uint) bool
- func (u *User) NewLoginLog(username string) *LoginLog
- func (u *User) Register(user, pass, email, roleIds string) error
- func (u *User) ResetLoginFails() error
- func (u *User) SetSession(users ...*dbschema.NgingUser)
- func (u *User) U2F(uid uint, typ string, step uint) (u2f *dbschema.NgingUserU2f, err error)
- func (u *User) UnsetSession()
- func (u *User) UpdateField(uid uint, set map[string]interface{}) (err error)
- func (u *User) VerifySession(users ...*dbschema.NgingUser) error
- type UserRole
- func (u *UserRole) Add() (interface{}, error)
- func (u *UserRole) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (u *UserRole) Exists(name string) (bool, error)
- func (u *UserRole) Exists2(name string, excludeID uint) (bool, error)
- func (u *UserRole) ListByUser(user *dbschema.NgingUser) (roleList []*dbschema.NgingUserRole)
- type UserRolePermission
- type UserU2F
- func (u *UserU2F) Add() (interface{}, error)
- func (u *UserU2F) HasType(uid uint, authType string, step uint) (bool, error)
- func (u *UserU2F) ListPageByType(uid uint, typ string, step uint, sorts ...interface{}) error
- func (u *UserU2F) Unbind(uid uint, typ string, step uint) error
- func (u *UserU2F) UnbindByToken(uid uint, typ string, step uint, token string) error
- type Verification
Constants ¶
const ( KvRootType = `root` AutoCreatedType = `autoCreated` KvDefaultDataType = `text` )
const StorageAccountIDKey = `storerID`
Variables ¶
var ( // SMSWaitingSeconds 短信发送后等待秒数 SMSWaitingSeconds int64 = 60 // SMSMaxPerDay 短信每人每天发送上限 SMSMaxPerDay int64 = 10 )
var KvDataTypes = echo.NewKVData().Add(`number`, `数字`).Add(`text`, `文本`).Add(`json`, `JSON`)
var SafeItems = echo.NewKVData().
Add(`gauth_bind`, `两步验证`).
Add(`password`, `修改密码`)
Functions ¶
func GetU2FStepCondValue ¶ added in v4.2.0
func GetU2FStepCondValue(step uint) interface{}
Types ¶
type AlertRecipient ¶
type AlertRecipient struct {
*dbschema.NgingAlertRecipient
}
func NewAlertRecipient ¶
func NewAlertRecipient(ctx echo.Context) *AlertRecipient
func (*AlertRecipient) Add ¶
func (s *AlertRecipient) Add() (pk interface{}, err error)
func (*AlertRecipient) GetWithExt ¶
func (s *AlertRecipient) GetWithExt(mw func(db.Result) db.Result, args ...interface{}) (row *AlertRecipientExt, err error)
type AlertRecipientExt ¶
type AlertRecipientExt struct {
*dbschema.NgingAlertRecipient
}
type AlertTopic ¶
type AlertTopic struct {
*dbschema.NgingAlertTopic
}
func NewAlertTopic ¶
func NewAlertTopic(ctx echo.Context) *AlertTopic
func (*AlertTopic) Add ¶
func (s *AlertTopic) Add(rows ...*dbschema.NgingAlertTopic) (pk interface{}, err error)
func (*AlertTopic) Exists ¶
func (s *AlertTopic) Exists(topic string, recipientId uint) (bool, error)
func (*AlertTopic) ExistsOther ¶
type AlertTopicExt ¶
type AlertTopicExt struct { *dbschema.NgingAlertTopic Recipient *dbschema.NgingAlertRecipient `db:"-,relation=id:recipient_id"` }
func (*AlertTopicExt) Send ¶
func (a *AlertTopicExt) Send(alertData *alertRegistry.AlertData) (err error)
type CloudBackup ¶
type CloudBackup struct {
*dbschema.NgingCloudBackup
}
func NewCloudBackup ¶
func NewCloudBackup(ctx echo.Context) *CloudBackup
func (*CloudBackup) Add ¶
func (s *CloudBackup) Add() (pk interface{}, err error)
func (*CloudBackup) ListPage ¶
func (s *CloudBackup) ListPage(cond *db.Compounds, sorts ...interface{}) ([]*CloudBackupExt, error)
type CloudBackupExt ¶
type CloudBackupExt struct { *dbschema.NgingCloudBackup Storage *dbschema.NgingCloudStorage `db:"-,relation=id:dest_storage"` Watching bool FullBackuping bool }
type CloudStorage ¶
type CloudStorage struct {
*dbschema.NgingCloudStorage
}
func GetCloudStorage ¶ added in v4.1.0
func GetCloudStorage(ctx context.Context) (*CloudStorage, error)
func NewCloudStorage ¶
func NewCloudStorage(ctx echo.Context) *CloudStorage
func (*CloudStorage) Add ¶
func (s *CloudStorage) Add() (pk interface{}, err error)
func (*CloudStorage) BaseURL ¶
func (s *CloudStorage) BaseURL() string
func (*CloudStorage) CachedList ¶
func (s *CloudStorage) CachedList() map[string]*dbschema.NgingCloudStorage
func (*CloudStorage) RawSecret ¶
func (s *CloudStorage) RawSecret() string
type Code ¶
type Code struct { Verification *dbschema.NgingCodeVerification Invitation *dbschema.NgingCodeInvitation *base.Base }
func (*Code) AddVerificationCode ¶
func (*Code) CheckFrequency ¶
func (*Code) CheckVerificationCode ¶
func (*Code) CountTodayVerificationCode ¶
func (*Code) LastVerificationCode ¶
func (*Code) UseInvitationCode ¶
func (c *Code) UseInvitationCode(m *dbschema.NgingCodeInvitation, usedUid uint) (err error)
func (*Code) UseVerificationCode ¶
func (c *Code) UseVerificationCode(m *dbschema.NgingCodeVerification) (err error)
func (*Code) VerfyInvitationCode ¶
type Config ¶
type Config struct {
*dbschema.NgingConfig
}
func (*Config) ValueByKey ¶
type Invitation ¶
type Invitation struct {
*dbschema.NgingCodeInvitation
}
func NewInvitation ¶
func NewInvitation(ctx echo.Context) *Invitation
type Kv ¶
func (*Kv) GetFromTypeList ¶
func (*Kv) GetTypeValues ¶
func (*Kv) IsRootType ¶
type LoginLog ¶
type LoginLog struct {
*dbschema.NgingLoginLog
}
func NewLoginLog ¶
func (*LoginLog) AddAndSaveSession ¶ added in v4.2.2
func (*LoginLog) GetLastFailure ¶ added in v4.2.2
func (*LoginLog) GetLastSuccess ¶ added in v4.2.2
func (*LoginLog) InitLocation ¶ added in v4.2.2
func (s *LoginLog) InitLocation() (ipInfo ip2regionparser.IpInfo, err error)
type SendingLog ¶
type SendingLog struct {
*dbschema.NgingSendingLog
}
func NewSendingLog ¶
func NewSendingLog(ctx echo.Context) *SendingLog
func (*SendingLog) Add ¶
func (c *SendingLog) Add() (interface{}, error)
type TaskAndGroup ¶
type TaskAndGroup struct { *dbschema.NgingTask Group *dbschema.NgingTaskGroup `db:"-,relation=id:group_id|gtZero"` }
type User ¶
func (*User) CheckPasswd ¶
func (*User) ClearPasswordData ¶
func (*User) FireLoginFailure ¶ added in v4.2.2
func (*User) FireLoginSuccess ¶ added in v4.2.2
func (*User) GetUserAllU2F ¶
func (u *User) GetUserAllU2F(uid uint) ([]*dbschema.NgingUserU2f, error)
func (*User) IncrLoginFails ¶ added in v4.2.2
func (*User) NewLoginLog ¶ added in v4.2.2
func (*User) ResetLoginFails ¶ added in v4.2.2
func (*User) SetSession ¶
func (*User) UnsetSession ¶
func (u *User) UnsetSession()
func (*User) UpdateField ¶
type UserRole ¶
type UserRole struct { *dbschema.NgingUserRole // contains filtered or unexported fields }
func NewUserRole ¶
func (*UserRole) ListByUser ¶
func (u *UserRole) ListByUser(user *dbschema.NgingUser) (roleList []*dbschema.NgingUserRole)
type UserRolePermission ¶ added in v4.1.0
type UserRolePermission struct {
*dbschema.NgingUserRolePermission
}
func NewUserRolePermission ¶ added in v4.1.0
func NewUserRolePermission(ctx echo.Context) *UserRolePermission
func (*UserRolePermission) Add ¶ added in v4.1.0
func (u *UserRolePermission) Add() (interface{}, error)
type UserU2F ¶ added in v4.2.0
type UserU2F struct {
*dbschema.NgingUserU2f
}
func NewUserU2F ¶ added in v4.2.0
func (*UserU2F) ListPageByType ¶ added in v4.2.2
type Verification ¶
type Verification struct {
*dbschema.NgingCodeVerification
}
func NewVerification ¶
func NewVerification(ctx echo.Context) *Verification
Source Files ¶
- alertRecipient.go
- alertRecipient_ext.go
- alertTopic.go
- alertTopic_ext.go
- cloudBackup.go
- cloudBackup_ext.go
- cloudStorage.go
- cloudStorage_utils.go
- code.go
- config.go
- invitation.go
- kv.go
- kv_ext.go
- loginLog.go
- sendingLog.go
- task.go
- taskGroup.go
- taskLog.go
- user.go
- userRole.go
- userRolePermission.go
- userRole_ext.go
- userU2F.go
- user_counter.go
- user_ext.go
- user_login.go
- user_register.go
- user_session.go
- user_u2f.go
- verification.go