service

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEventMeta

func GetEventMeta(ctx context.Context, action string, beginTime time.Time, err error) (eventId, message string, status bool, took time.Duration)

Types

type CommonService

type CommonService interface {
	RecordUploadFile(ctx context.Context, name string, path string, contentType string, size int64) (id string, err error)
	UpdateFileOwner(ctx context.Context, fileId string, owner string) (err error)
	GetFilesByOwner(ctx context.Context, owner string, current int64, pageSize int64) (count int64, files []*models.Model, err error)
	GetFileInfoFromId(ctx context.Context, id string) (fileName, mimiType, filePath string, err error)
	CreateRole(ctx context.Context, role *models.Role) (err error)
	UpdateRole(ctx context.Context, role *models.Role) (err error)
	GetRoles(ctx context.Context, keywords string, current, pageSize int64) (count int64, roles []*models.Role, err error)
	GetPermissions(ctx context.Context, keywords string, current int64, pageSize int64) (count int64, permissions []*models.Permission, err error)
	DeleteRoles(ctx context.Context, ids []string) error
	RegisterPermission(ctx context.Context, permissions models.Permissions) error
	CreateOrUpdateRoleByName(ctx context.Context, role *models.Role) error
	Authorization(ctx context.Context, roles []string, method string) bool
	BatchPatchI18n(ctx context.Context, i18ns []models.I18nTranslate) (err error)

	GetUserExtendedData(ctx context.Context, id string) (*models.UserExt, error)
	GetUsersExtendedData(ctx context.Context, id []string) ([]*models.UserExt, error)
	PatchUserExtData(ctx context.Context, id string, patch map[string]interface{}) error
	GetProxyConfig(ctx context.Context, host string) (*models.AppProxyConfig, error)
	UpdateAppProxyConfig(ctx context.Context, proxy *models.AppProxy) error
	GetAppProxyConfig(ctx context.Context, appId string) (proxy *models.AppProxy, err error)
	UpdateAppAccessControl(ctx context.Context, app *models.App) error
	UpdateUserAccessControl(ctx context.Context, userId string, appUsers models.Apps) error
	GetAppAccessControl(ctx context.Context, appId string, o ...opts.WithGetAppOptions) (users models.AppUsers, roles models.AppRoles, err error)
	GetAppRoleByUserId(ctx context.Context, appId string, userId string) (role *models.AppRole, err error)

	AppAuthorization(ctx context.Context, key string, secret string) (id string, err error)
	CreateAppKey(ctx context.Context, appId, name string) (*models.AppKey, error)
	DeleteAppKeys(ctx context.Context, appId string, id []string) (affected int64, err error)
	GetAppKeys(ctx context.Context, appId string, current, pageSize int64) (count int64, keyPairs []*models.AppKey, err error)
	GetAppKeyFromKey(ctx context.Context, key string) (appKey *models.AppKey, err error)

	GetPages(ctx context.Context, filter map[string]interface{}, keywords string, current int64, size int64) (int64, []*models.PageConfig, error)
	CreatePage(ctx context.Context, page *models.PageConfig) error
	UpdatePage(ctx context.Context, page *models.PageConfig) error
	DeletePages(ctx context.Context, ids []string) error
	GetPage(ctx context.Context, id string) (*models.PageConfig, error)
	PatchPages(ctx context.Context, patch []map[string]interface{}) error

	GetPageDatas(ctx context.Context, filters map[string]string, keywords string, current int64, size int64) (int64, []*models.PageData, error)
	GetPageData(ctx context.Context, pageId string, id string) (*models.PageData, error)
	CreatePageData(ctx context.Context, pageId string, data *json.RawMessage) error
	UpdatePageData(ctx context.Context, pageId string, id string, data *json.RawMessage) error
	PatchPageDatas(ctx context.Context, patch []models.PageData) error
	CreateTOTP(ctx context.Context, ids string, secret string) error
	GetTOTPSecrets(ctx context.Context, ids []string) ([]string, error)
	PatchSystemConfig(ctx context.Context, prefix string, patch map[string]interface{}) error
	GetSystemConfig(ctx context.Context, prefix string) (map[string]interface{}, error)
	VerifyAndRecordHistoryPassword(ctx context.Context, id string, password string) error
	UpdateLoginTime(ctx context.Context, id string) error
	VerifyWeakPassword(ctx context.Context, password string) error
	InsertWeakPassword(ctx context.Context, passwords ...string) error
	GetAppRoles(ctx context.Context, id string) (models.AppRoles, error)
	DeleteAppProxy(ctx context.Context, id ...string) error
	DeleteAppAccessControl(ctx context.Context, id ...string) error
	DeleteI18nBySourceId(ctx context.Context, id ...string) error
	GetI18n(ctx context.Context, source string, sourceId string, field string) (map[string]string, error)
	PatchAppOAuthConfig(ctx context.Context, auth2 *models.AppOAuth2) error
	GetAppOAuthConfig(ctx context.Context, id string) (*models.AppOAuth2, error)
	FindAppByKeywords(ctx context.Context, keywords string, skip int64, limit int64) ([]string, int64)
	// contains filtered or unexported methods
}

func NewCommonService

func NewCommonService(ctx context.Context) CommonService

type LoggingService

type LoggingService interface {
	PostEventLog(ctx context.Context, eventId, userId, username, clientIP, loc, action, message string, status bool, took time.Duration, log ...interface{}) error
	GetEvents(ctx context.Context, filters map[string]string, keywords string, startTime time.Time, endTime time.Time, current int64, size int64) (count int64, event []*models.Event, err error)
	GetEventLogs(ctx context.Context, filters map[string]string, keywords string, current int64, size int64) (count int64, event []*models.EventLog, err error)
	// contains filtered or unexported methods
}

func NewLoggingService

func NewLoggingService(ctx context.Context) LoggingService

type Service

type Service interface {
	InitData(ctx context.Context, username string) error
	DeleteLoginSession(ctx context.Context, session string) error
	GetSessionByToken(ctx context.Context, id string, tokenType models.TokenType, receiver interface{}) error
	VerifyPassword(ctx context.Context, username string, password string, allowPasswordExpired bool) (user *models.User, err error)
	VerifyPasswordById(ctx context.Context, userId, password string, allowPasswordExpired bool) (user *models.User)
	VerifyUserStatus(ctx context.Context, user *models.User, allowPasswordExpired bool) (err error)
	GetOAuthTokenByAuthorizationCode(ctx context.Context, code, clientId string) (accessToken, refreshToken string, expiresIn int, err error)
	RefreshOAuthTokenByAuthorizationCode(ctx context.Context, token, clientId, clientSecret string) (accessToken, refreshToken string, expiresIn int, err error)
	RefreshOAuthTokenByPassword(ctx context.Context, token, username, password string) (accessToken, refreshToken string, expiresIn int, err error)
	GetSessions(ctx context.Context, userId string, current int64, size int64) (int64, []*models.Token, error)
	DeleteToken(ctx context.Context, tokenType models.TokenType, id string) (err error)

	UploadFile(ctx context.Context, name, contentType string, f io.Reader) (fileKey string, err error)
	DownloadFile(ctx context.Context, id string) (f io.ReadCloser, mimiType, fileName string, err error)

	CreateRole(ctx context.Context, role *models.Role) (err error)
	UpdateRole(ctx context.Context, role *models.Role) (err error)
	GetRoles(ctx context.Context, keywords string, current, pageSize int64) (count int64, roles []*models.Role, err error)
	GetPermissions(ctx context.Context, keywords string, current int64, pageSize int64) (count int64, permissions []*models.Permission, err error)
	DeleteRoles(ctx context.Context, ids []string) error

	GetUsers(ctx context.Context, keywords string, status models.UserMeta_UserStatus, appId string, current, pageSize int64) (total int64, users models.Users, err error)
	PatchUsers(ctx context.Context, patch []map[string]interface{}) (count int64, err error)
	DeleteUsers(ctx context.Context, id []string) (count int64, err error)
	UpdateUser(ctx context.Context, user *models.User, updateColumns ...string) (err error)
	GetUserInfo(ctx context.Context, id, username string) (user *models.User, err error)
	GetUser(ctx context.Context, options ...opts.WithGetUserOptions) (user *models.User, err error)
	GetUserInfoByUsernameAndEmail(ctx context.Context, username, email string) (user *models.User, err error)
	CreateUser(ctx context.Context, user *models.User) (err error)
	PatchUser(ctx context.Context, user map[string]interface{}) (err error)
	DeleteUser(ctx context.Context, id string) error
	PatchUserExtData(ctx context.Context, id string, m map[string]interface{}) error
	Authentication(ctx context.Context, method models.AuthMeta_Method, algorithm sign.AuthAlgorithm, key, secret, payload, signStr string) (*models.User, error)

	GetApps(ctx context.Context, keywords string, filter map[string]interface{}, current, pageSize int64) (total int64, apps []*models.App, err error)
	PatchApps(ctx context.Context, patch []map[string]interface{}) (total int64, err error)
	DeleteApps(ctx context.Context, id ...string) (total int64, err error)
	UpdateApp(ctx context.Context, app *models.App, updateColumns ...string) (err error)
	GetAppInfo(ctx context.Context, options ...opts.WithGetAppOptions) (app *models.App, err error)
	GetAppRoleByUserId(ctx context.Context, appId string, userId string) (role *models.AppRole, err error)
	GetIssuerByAppId(ctx context.Context, appId string) (issuer jwtutils.JWTIssuer, err error)

	CreateApp(ctx context.Context, app *models.App) (err error)
	PatchApp(ctx context.Context, fields map[string]interface{}) (err error)
	DeleteApp(ctx context.Context, id string) (err error)
	PatchAppI18n(ctx context.Context, appId string, options *models.AppI18NOptions) (err error)
	ResetPassword(ctx context.Context, id, password string) error

	UpdateToken(ctx context.Context, id string, tokenType models.TokenType, data interface{}) (err error)
	UpdateUserSession(ctx context.Context, userId string) (err error)
	CreateToken(ctx context.Context, tokenType models.TokenType, data interface{}) (token *models.Token, err error)
	VerifyToken(ctx context.Context, token string, tokenType models.TokenType, receiver interface{}, relationId ...string) bool
	SendEmail(ctx context.Context, data map[string]interface{}, topic string, to ...string) error
	Authorization(ctx context.Context, user *models.User, method string) bool
	RegisterPermission(ctx context.Context, permissions models.Permissions) error
	GetProxyConfig(ctx context.Context, host string) (*models.AppProxyConfig, error)
	SendProxyRequest(ctx context.Context, r *gohttp.Request, proxyConfig *models.AppProxyConfig, proxyURL *models.AppProxyUrl) (*gohttp.Response, error)
	AppAuthentication(ctx context.Context, username string, password string) (*models.App, error)
	CreateAppKey(ctx context.Context, appId string, name string) (appKey *models.AppKey, err error)
	GetAppKeys(ctx context.Context, appId string, current int64, pageSize int64) (count int64, keys []*models.AppKey, err error)
	GetAppIcons(ctx context.Context, current int64, pageSize int64) (count int64, keys []*models.Model, err error)
	DeleteAppKey(ctx context.Context, appId string, id []string) (affected int64, err error)
	GetAppKeyFromKey(ctx context.Context, key string) (appKey *models.AppKey, err error)

	DeletePages(ctx context.Context, strings []string) error
	UpdatePage(ctx context.Context, role *models.PageConfig) error
	CreatePage(ctx context.Context, page *models.PageConfig) error
	GetPages(ctx context.Context, filter map[string]interface{}, keywords string, current int64, size int64) (int64, []*models.PageConfig, error)
	GetPage(ctx context.Context, id string) (*models.PageConfig, error)
	PatchPages(ctx context.Context, pages []map[string]interface{}) error

	PatchPageDatas(ctx context.Context, patch []models.PageData) error
	UpdatePageData(ctx context.Context, pageId string, id string, data *json.RawMessage) error
	CreatePageData(ctx context.Context, pageId string, data *json.RawMessage) error
	GetPageData(ctx context.Context, pageId string, id string) (*models.PageData, error)
	GetPageDatas(ctx context.Context, filters map[string]string, keywords string, current int64, size int64) (int64, []*models.PageData, error)
	CreateTOTP(ctx context.Context, ids string, secret string) error
	GetTOTPSecrets(ctx context.Context, ids []string) ([]string, error)
	PatchSystemConfig(ctx context.Context, prefix string, patch map[string]interface{}) error
	LoadSystemConfig(ctx context.Context) error
	PostEventLog(ctx context.Context, eventId, userId, username, clientIP, action, message string, status bool, took time.Duration, log ...interface{}) error
	GetEvents(ctx context.Context, filters map[string]string, keywords string, startTime time.Time, endTime time.Time, current int64, size int64) (count int64, event []*models.Event, err error)
	GetEventLogs(ctx context.Context, filters map[string]string, keywords string, current int64, size int64) (count int64, event []*models.EventLog, err error)
	InsertWeakPassword(ctx context.Context, passwords ...string) error
	VerifyWeakPassword(ctx context.Context, password string) error
	UpdateTokenExpires(ctx context.Context, id string, expiry time.Time) error
	BatchPatchI18n(ctx context.Context, i18ns []models.I18nTranslate) (err error)
	// contains filtered or unexported methods
}

func New

func New(ctx context.Context) Service

New returns a basic Service with all of the expected middlewares wired in.

type SessionService

type SessionService interface {
	GetSessions(ctx context.Context, userId string, current int64, size int64) (int64, []*models.Token, error)
	RefreshOAuthTokenByAuthorizationCode(ctx context.Context, token, clientId, clientSecret string) (accessToken, refreshToken string, expiresIn int, err error)
	RefreshOAuthTokenByPassword(ctx context.Context, token, username, password string) (accessToken, refreshToken string, expiresIn int, err error)
	DeleteToken(ctx context.Context, tokenType models.TokenType, id string) (err error)
	GetToken(ctx context.Context, token string, tokenType models.TokenType, relationId ...string) (*models.Token, error)
	CreateToken(ctx context.Context, token *models.Token) error
	UpdateToken(ctx context.Context, token *models.Token) error
	Counter(ctx context.Context, seed string, expireTime *time.Time, num ...int64) (err error)
	GetCounter(ctx context.Context, seed string) (count int64, err error)
	UpdateTokenExpires(ctx context.Context, id string, expiry time.Time) error
	// contains filtered or unexported methods
}

func NewSessionService

func NewSessionService(ctx context.Context) SessionService

type Set

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

func (Set) AppAuthentication

func (s Set) AppAuthentication(ctx context.Context, key string, secret string) (*models.App, error)

func (Set) Authentication

func (s Set) Authentication(ctx context.Context, method models.AuthMeta_Method, algorithm sign.AuthAlgorithm, key, secret, payload, signStr string) (user *models.User, err error)

Authentication

@Description[en-US]: Authenticate the user's request.
@Description[zh-CN]: 对用户请求进行身份认证。
@param ctx 	context.Context
@param method 	models.AuthMeta_Method
@param algorithm 	sign.AuthAlgorithm
@param key 	string
@param secret 	string
@param payload 	string
@param signStr 	string
@return user	[]*models.User
@return err	error

func (Set) Authorization

func (s Set) Authorization(ctx context.Context, user *models.User, method string) bool

func (Set) AutoMigrate

func (s Set) AutoMigrate(ctx context.Context) error

func (Set) BatchPatchI18n

func (s Set) BatchPatchI18n(ctx context.Context, i18ns []models.I18nTranslate) (err error)

func (Set) CreateApp

func (s Set) CreateApp(ctx context.Context, app *models.App) (err error)

func (Set) CreateAppKey

func (s Set) CreateAppKey(ctx context.Context, appId string, name string) (appKey *models.AppKey, err error)

func (Set) CreatePage

func (s Set) CreatePage(ctx context.Context, page *models.PageConfig) error

func (Set) CreatePageData

func (s Set) CreatePageData(ctx context.Context, pageId string, data *json.RawMessage) error

func (Set) CreateRole

func (s Set) CreateRole(ctx context.Context, role *models.Role) (err error)

func (Set) CreateTOTP

func (s Set) CreateTOTP(ctx context.Context, id string, secret string) error

func (Set) CreateToken

func (s Set) CreateToken(ctx context.Context, tokenType models.TokenType, data interface{}) (token *models.Token, err error)

func (Set) CreateUser

func (s Set) CreateUser(ctx context.Context, user *models.User) (err error)

CreateUser

@Description[en-US]: Create a user.
@Description[zh-CN]: 创建用户。
@param ctx 	context.Context
@param user 	*models.User
@return err	error

func (Set) DeleteApp

func (s Set) DeleteApp(ctx context.Context, id string) (err error)

func (Set) DeleteAppKey

func (s Set) DeleteAppKey(ctx context.Context, appId string, id []string) (affected int64, err error)

func (Set) DeleteApps

func (s Set) DeleteApps(ctx context.Context, id ...string) (total int64, err error)

func (Set) DeleteLoginSession

func (s Set) DeleteLoginSession(ctx context.Context, sessionId string) error

func (Set) DeletePages

func (s Set) DeletePages(ctx context.Context, ids []string) error

func (Set) DeleteRoles

func (s Set) DeleteRoles(ctx context.Context, ids []string) error

func (Set) DeleteToken

func (s Set) DeleteToken(ctx context.Context, tokenType models.TokenType, id string) (err error)

func (Set) DeleteUser

func (s Set) DeleteUser(ctx context.Context, id string) (err error)

DeleteUser

@Description[en-US]: Delete a user.
@Description[zh-CN]: 删除用户。
@param ctx 	context.Context
@param id 	string
@return error

func (Set) DeleteUsers

func (s Set) DeleteUsers(ctx context.Context, id []string) (total int64, err error)

DeleteUsers

@Description[en-US]: Delete users in batch.
@Description[zh-CN]: 批量删除用户。
@param ctx 		context.Context
@param ids 		[]string
@return count	int64
@return err		error

func (Set) DownloadFile

func (s Set) DownloadFile(ctx context.Context, id string) (f io.ReadCloser, mimiType, fileName string, err error)

func (Set) GetAppAccessControl

func (s Set) GetAppAccessControl(ctx context.Context, app *models.App, o ...opts.WithGetAppOptions) (err error)

func (Set) GetAppIcons

func (s Set) GetAppIcons(ctx context.Context, current int64, pageSize int64) (count int64, keys []*models.Model, err error)

func (Set) GetAppInfo

func (s Set) GetAppInfo(ctx context.Context, o ...opts.WithGetAppOptions) (app *models.App, err error)

func (Set) GetAppKeyFromKey

func (s Set) GetAppKeyFromKey(ctx context.Context, key string) (appKey *models.AppKey, err error)

func (Set) GetAppKeys

func (s Set) GetAppKeys(ctx context.Context, appId string, current int64, pageSize int64) (count int64, keys []*models.AppKey, err error)

func (Set) GetAppRoleByUserId

func (s Set) GetAppRoleByUserId(ctx context.Context, appId string, userId string) (role *models.AppRole, err error)

func (Set) GetApps

func (s Set) GetApps(ctx context.Context, keywords string, filter map[string]interface{}, current, pageSize int64) (total int64, apps []*models.App, err error)

func (Set) GetEventLogs

func (s Set) GetEventLogs(ctx context.Context, filters map[string]string, keywords string, current int64, size int64) (count int64, event []*models.EventLog, err error)

func (Set) GetEvents

func (s Set) GetEvents(ctx context.Context, filters map[string]string, keywords string, startTime, endTime time.Time, current int64, size int64) (count int64, event []*models.Event, err error)

func (Set) GetIssuerByAppId added in v1.4.3

func (s Set) GetIssuerByAppId(ctx context.Context, appId string) (jwtutils.JWTIssuer, error)

func (Set) GetOAuthTokenByAuthorizationCode

func (s Set) GetOAuthTokenByAuthorizationCode(ctx context.Context, code, clientId string) (accessToken, refreshToken string, expiresIn int, err error)

func (Set) GetPage

func (s Set) GetPage(ctx context.Context, id string) (*models.PageConfig, error)

func (Set) GetPageData

func (s Set) GetPageData(ctx context.Context, pageId string, id string) (*models.PageData, error)

func (Set) GetPageDatas

func (s Set) GetPageDatas(ctx context.Context, filters map[string]string, keywords string, current int64, size int64) (int64, []*models.PageData, error)

func (Set) GetPages

func (s Set) GetPages(ctx context.Context, filter map[string]interface{}, keywords string, current int64, size int64) (int64, []*models.PageConfig, error)

func (Set) GetPermissions

func (s Set) GetPermissions(ctx context.Context, keywords string, current int64, pageSize int64) (count int64, permissions []*models.Permission, err error)

func (Set) GetProxyConfig

func (s Set) GetProxyConfig(ctx context.Context, host string) (*models.AppProxyConfig, error)

func (Set) GetRoles

func (s Set) GetRoles(ctx context.Context, keywords string, current, pageSize int64) (count int64, roles []*models.Role, err error)

func (Set) GetSessionByToken

func (s Set) GetSessionByToken(ctx context.Context, id string, tokenType models.TokenType, receiver interface{}) (err error)

func (Set) GetSessions

func (s Set) GetSessions(ctx context.Context, userId string, current, size int64) (int64, []*models.Token, error)

func (Set) GetTOTPSecrets

func (s Set) GetTOTPSecrets(ctx context.Context, ids []string) ([]string, error)

func (Set) GetUser

func (s Set) GetUser(ctx context.Context, options ...opts.WithGetUserOptions) (user *models.User, err error)

GetUser

@Description[en-US]: Get user info.
@Description[zh-CN]: 获取用户信息
@param ctx 	context.Context
@param options 	opts.WithGetUserOptions
@return userDetail	*models.User
@return err	error

func (Set) GetUserAndAppService

func (s Set) GetUserAndAppService() UserAndAppService

func (Set) GetUserInfo

func (s Set) GetUserInfo(ctx context.Context, id string, username string) (user *models.User, err error)

GetUserInfo

@Description[en-US]: Obtain user information through ID or username.
@Description[zh-CN]: 通过ID或用户名获取用户信息。
@param ctx 	context.Context
@param id 	string
@param username 	string
@return userDetail	*models.User
@return err	error

func (Set) GetUserInfoByUsernameAndEmail

func (s Set) GetUserInfoByUsernameAndEmail(ctx context.Context, username, email string) (users *models.User, err error)

func (Set) GetUsers

func (s Set) GetUsers(ctx context.Context, keywords string, status models.UserMeta_UserStatus, appId string, current, pageSize int64) (total int64, users models.Users, err error)

GetUsers

@Description[en-US]: Get user list.
@Description[zh-CN]: 获取用户列表。
@param ctx       context.Context
@param keywords  string
@param status    models.UserMeta_UserStatus
@param appId     string
@param current   int64
@param pageSize  int64
@return total    int64
@return users    []*models.User
@return err      error

func (Set) InitData

func (s Set) InitData(ctx context.Context, username string) error

func (Set) InsertWeakPassword

func (s Set) InsertWeakPassword(ctx context.Context, passwords ...string) error

func (Set) LoadSystemConfig

func (s Set) LoadSystemConfig(ctx context.Context) error

func (Set) PatchApp

func (s Set) PatchApp(ctx context.Context, fields map[string]interface{}) (err error)

func (Set) PatchAppI18n

func (s Set) PatchAppI18n(ctx context.Context, appId string, options *models.AppI18NOptions) (err error)

func (Set) PatchApps

func (s Set) PatchApps(ctx context.Context, patch []map[string]interface{}) (total int64, err error)

func (Set) PatchPageDatas

func (s Set) PatchPageDatas(ctx context.Context, patch []models.PageData) error

func (Set) PatchPages

func (s Set) PatchPages(ctx context.Context, patch []map[string]interface{}) error

func (Set) PatchSystemConfig

func (s Set) PatchSystemConfig(ctx context.Context, prefix string, patch map[string]interface{}) error

func (Set) PatchUser

func (s Set) PatchUser(ctx context.Context, user map[string]interface{}) (err error)

PatchUser

@Description[en-US]: Incremental update user.
@Description[zh-CN]: 增量更新用户。
@param ctx 	context.Context
@param user 	map[string]interface{}
@return err	error

func (Set) PatchUserExtData

func (s Set) PatchUserExtData(ctx context.Context, userId string, patch map[string]interface{}) (err error)

PatchUserExtData

@Description[en-US]: Incremental update user.
@Description[zh-CN]: 增量更新用户扩展信息。
@param ctx 	context.Context
@param id 	string
@param patch 	map[string]interface{}
@return err	error

func (Set) PatchUsers

func (s Set) PatchUsers(ctx context.Context, patch []map[string]interface{}) (total int64, err error)

PatchUsers

@Description[en-US]: Incrementally update information of multiple users.
@Description[zh-CN]: 增量更新多个用户的信息。
@param ctx 		context.Context
@param patch 	[]map[string]interface{}
@return count	int64
@return err		error

func (Set) PostEventLog

func (s Set) PostEventLog(ctx context.Context, eventId, userId, username, clientIP, action, message string, status bool, took time.Duration, log ...interface{}) (err error)

func (Set) RefreshOAuthTokenByAuthorizationCode

func (s Set) RefreshOAuthTokenByAuthorizationCode(ctx context.Context, token, clientId, clientSecret string) (accessToken, refreshToken string, expiresIn int, err error)

func (Set) RefreshOAuthTokenByPassword

func (s Set) RefreshOAuthTokenByPassword(ctx context.Context, token, username, password string) (accessToken, refreshToken string, expiresIn int, err error)

func (Set) RegisterPermission

func (s Set) RegisterPermission(ctx context.Context, permissions models.Permissions) error

func (Set) ResetPassword

func (s Set) ResetPassword(ctx context.Context, id string, password string) (err error)

func (Set) SendEmail

func (s Set) SendEmail(ctx context.Context, data map[string]interface{}, topic string, to ...string) error

func (Set) SendProxyRequest

func (s Set) SendProxyRequest(ctx context.Context, r *gohttp.Request, proxyConfig *models.AppProxyConfig, proxyURL *models.AppProxyUrl) (*gohttp.Response, error)

func (Set) UpdateApp

func (s Set) UpdateApp(ctx context.Context, app *models.App, updateColumns ...string) (err error)

func (Set) UpdatePage

func (s Set) UpdatePage(ctx context.Context, page *models.PageConfig) error

func (Set) UpdatePageData

func (s Set) UpdatePageData(ctx context.Context, pageId string, id string, data *json.RawMessage) error

func (Set) UpdateRole

func (s Set) UpdateRole(ctx context.Context, role *models.Role) (err error)

func (Set) UpdateToken

func (s Set) UpdateToken(ctx context.Context, id string, tokenType models.TokenType, data interface{}) (err error)

func (Set) UpdateTokenExpires

func (s Set) UpdateTokenExpires(ctx context.Context, id string, expiry time.Time) (err error)

func (Set) UpdateUser

func (s Set) UpdateUser(ctx context.Context, user *models.User, updateColumns ...string) (err error)

UpdateUser

@Description[en-US]: Update user information.
@Description[zh-CN]: 更新用户信息.
@param ctx	context.Context
@param user	*models.User
@param updateColumns	...string
@return err	error

func (Set) UpdateUserSession

func (s Set) UpdateUserSession(ctx context.Context, userId string) (err error)

func (Set) UploadFile

func (s Set) UploadFile(ctx context.Context, name, contentType string, f io.Reader) (fileKey string, err error)

func (Set) VerifyPassword

func (s Set) VerifyPassword(ctx context.Context, username string, password string, allowPasswordExpired bool) (user *models.User, err error)

VerifyPassword

@Description[en-US]: Verify password for user.
@Description[zh-CN]: 验证用户密码。
@param ctx 	context.Context
@param username 	string
@param password 	string
@return users	[]*models.User

func (Set) VerifyPasswordById

func (s Set) VerifyPasswordById(ctx context.Context, userId, password string, allowPasswordExpired bool) (user *models.User)

VerifyPasswordById

@Description[en-US]: Verify the user's password through ID.
@Description[zh-CN]: 通过ID验证用户密码。
@param ctx 	context.Context
@param id 	string
@param password 	string
@return users	[]*models.User

func (Set) VerifyToken

func (s Set) VerifyToken(ctx context.Context, token string, tokenType models.TokenType, receiver interface{}, relationId ...string) bool

func (Set) VerifyUserStatus

func (s Set) VerifyUserStatus(ctx context.Context, user *models.User, allowPasswordExpired bool) (err error)

func (Set) VerifyWeakPassword

func (s Set) VerifyWeakPassword(ctx context.Context, password string) error

type UserAndAppService

type UserAndAppService interface {
	Name() string
	GetUsers(ctx context.Context, keywords string, status models.UserMeta_UserStatus, appId string, current, pageSize int64) (total int64, users []*models.User, err error)
	PatchUsers(ctx context.Context, patch []map[string]interface{}) (count int64, err error)
	DeleteUsers(ctx context.Context, id []string) (count int64, err error)
	UpdateUser(ctx context.Context, user *models.User, updateColumns ...string) (err error)
	GetUserInfo(ctx context.Context, id string, username string) (*models.User, error)
	GetUser(ctx context.Context, options *opts.GetUserOptions) (*models.User, error)
	CreateUser(ctx context.Context, user *models.User) (err error)
	PatchUser(ctx context.Context, user map[string]interface{}) (err error)
	DeleteUser(ctx context.Context, id string) error
	VerifyPassword(ctx context.Context, username string, password string) *models.User

	GetApps(ctx context.Context, keywords string, filter map[string]interface{}, current, pageSize int64) (total int64, apps []*models.App, err error)
	PatchApps(ctx context.Context, patch []map[string]interface{}) (total int64, err error)
	DeleteApps(ctx context.Context, id ...string) (total int64, err error)
	UpdateApp(ctx context.Context, app *models.App, updateColumns ...string) (err error)
	GetAppInfo(ctx context.Context, o ...opts.WithGetAppOptions) (app *models.App, err error)
	CreateApp(ctx context.Context, app *models.App) (err error)
	PatchApp(ctx context.Context, fields map[string]interface{}) (err error)
	DeleteApp(ctx context.Context, id string) (err error)

	ResetPassword(ctx context.Context, id string, password string) error
	GetUserInfoByUsernameAndEmail(ctx context.Context, username, email string) (*models.User, error)
	VerifyPasswordById(ctx context.Context, id, password string) (user *models.User)
	GetUsersById(ctx context.Context, id []string) (models.Users, error)
	// contains filtered or unexported methods
}

func NewUserAndAppService

func NewUserAndAppService(ctx context.Context) UserAndAppService

type UserAndAppServices

type UserAndAppServices []UserAndAppService

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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