services

package
v0.0.0-...-4dfe643 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRootUser

func IsRootUser(user *models.User) bool

Types

type AuditorInfo

type AuditorInfo struct {
	Tenant *models.Tenant
	User   *models.User
}

type AuditorService

type AuditorService struct {
	Lang        string
	AuditorInfo *AuditorInfo
	Session     *db.Session
}

func NewAuditorService

func NewAuditorService(session *db.Session, lang string, info *AuditorInfo) *AuditorService

func (*AuditorService) OnAudit

func (this *AuditorService) OnAudit(format string, v ...interface{})

func (*AuditorService) OnAuditWithNewDbSession

func (this *AuditorService) OnAuditWithNewDbSession(format string, v ...interface{})

type AuthData

type AuthData struct {
	UserName   string `json:"username" valid:"Required"`
	Password   string `json:"password" valid:"Required"`
	TenantUUID string `json:"tenant_uuid"`
}

type AuthResult

type AuthResult struct {
	Token     string `json:"token"`
	ExpiresAt int64  `json:"expires_at"`
}

type AuthService

type AuthService struct {
	UserInfo *models.User
	Session  *db.Session
}

func NewAuthService

func NewAuthService(session *db.Session) *AuthService

func (*AuthService) Auth

func (this *AuthService) Auth(body []byte, allowedRoles []string) *rio.IO[*AuthResult]

Auth by bearer token

func (*AuthService) AuthAdmin

func (this *AuthService) AuthAdmin(body []byte) *rio.IO[*AuthResult]

func (*AuthService) AuthRoot

func (this *AuthService) AuthRoot(body []byte) *rio.IO[*AuthResult]

func (*AuthService) AuthRootOrAdmin

func (this *AuthService) AuthRootOrAdmin(body []byte) *rio.IO[*AuthResult]

func (*AuthService) CheckBearerToken

func (this *AuthService) CheckBearerToken(bearerToken string) (*models.User, error)

func (*AuthService) GetUserRoles

func (this *AuthService) GetUserRoles() []string

func (*AuthService) IsAdmin

func (this *AuthService) IsAdmin() bool

func (*AuthService) IsAuthenticated

func (this *AuthService) IsAuthenticated() bool

func (*AuthService) IsBearerToken

func (this *AuthService) IsBearerToken(token string) bool

func (*AuthService) IsRoot

func (this *AuthService) IsRoot() bool

func (*AuthService) SetUserInfo

func (this *AuthService) SetUserInfo(user *models.User)

func (*AuthService) ValidPassword

func (this *AuthService) ValidPassword(password1 string, password2 string) error

type AuthUser

type AuthUser struct {
	Data *AuthData
	User *models.User
}

type LoginErrorTenantNotFound

type LoginErrorTenantNotFound struct {
	Message string
}

func LoginTenantNotFound

func LoginTenantNotFound(msg string) *LoginErrorTenantNotFound

func (*LoginErrorTenantNotFound) Error

func (e *LoginErrorTenantNotFound) Error() string

type LoginErrorUserInactive

type LoginErrorUserInactive struct {
	Message string
}

func LoginUserInactive

func LoginUserInactive(msg string) *LoginErrorUserInactive

func (*LoginErrorUserInactive) Error

func (e *LoginErrorUserInactive) Error() string

type LoginErrorUserNotFound

type LoginErrorUserNotFound struct {
	Message string
}

func LoginUserNotFound

func LoginUserNotFound(msg string) *LoginErrorUserNotFound

func (*LoginErrorUserNotFound) Error

func (e *LoginErrorUserNotFound) Error() string

type LoginErrorWrongPassword

type LoginErrorWrongPassword struct {
	Message string
}

func LoginWrongPassword

func LoginWrongPassword(msg string) *LoginErrorWrongPassword

func (*LoginErrorWrongPassword) Error

func (e *LoginErrorWrongPassword) Error() string

type LoginService

type LoginService struct {
	Lang            string
	Session         *db.Session
	ModelUser       *models.User
	ModelTenantUser *models.TenantUser
}

func NewLoginService

func NewLoginService(lang string, session *db.Session) *LoginService

func (*LoginService) Authenticate

func (this *LoginService) Authenticate(username string, password string) (*models.User, error)

func (*LoginService) AuthenticateToken

func (this *LoginService) AuthenticateToken(token string) (*models.User, error)

func (*LoginService) GetMessage

func (this *LoginService) GetMessage(key string, args ...interface{}) string

func (*LoginService) Login

func (this *LoginService) Login(user *models.User, password string, byToken bool, err error) (*models.User, error)

type MailService

type MailService struct {
	Controller                  beego.Controller
	PasswordRecoverTemplateName string

	ApiKey               string
	ApiAppName           string
	AppName              string
	AppUrl               string
	EmailDefault         string
	EmailPasswordDefault string

	MailServerUrl string
}

func NewMailService

func NewMailService(data map[string]string) *MailService

func (*MailService) GenerateHash

func (this *MailService) GenerateHash(body []byte) string

func (*MailService) GetDefaultEmail

func (this *MailService) GetDefaultEmail() map[string]string

func (*MailService) GetHtmlTemplate

func (this *MailService) GetHtmlTemplate(templateName string) (string, error)

func (*MailService) OnTemplate

func (this *MailService) OnTemplate(templateName string, values map[string]string) (string, error)

func (*MailService) PostEmail

func (this *MailService) PostEmail(email map[string]string) error

func (*MailService) ReplaceTemplate

func (this *MailService) ReplaceTemplate(templateContent string, values map[string]string) string

func (*MailService) Send

func (this *MailService) Send(email *models.Email) error

func (*MailService) SendPasswordRecover

func (this *MailService) SendPasswordRecover(to string, name string, token string) error

func (*MailService) SendPasswordRecoverCode

func (this *MailService) SendPasswordRecoverCode(to string, name string, code string) error

func (*MailService) SendPasswordRecoverWithUrl

func (this *MailService) SendPasswordRecoverWithUrl(to string, name string, url string) error

type PushService

type PushService struct {
	Session *db.Session
	// contains filtered or unexported fields
}

func NewPushService

func NewPushService(session *db.Session) *PushService

func (*PushService) Configure

func (this *PushService) Configure(data map[string]string)

func (*PushService) NotificateAll

func (this *PushService) NotificateAll(message string) error

func (*PushService) NotificateByQuery

func (this *PushService) NotificateByQuery(query string, message string) error

query should return a username list

func (*PushService) NotificateByUserNameList

func (this *PushService) NotificateByUserNameList(usernameList []string, message string) error

func (*PushService) NotificateUserName

func (this *PushService) NotificateUserName(username string, message string) error

type Subscriber

type Subscriber struct {
	Id    string
	Name  string
	Email string
	Dev   bool
}

Jump to

Keyboard shortcuts

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