services

package
v3.0.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashToken

func HashToken(source string) (result string, err error)

func LoadEmailService

func LoadEmailService()

func SendEmailViaDebug

func SendEmailViaDebug(to, subject, body string, async bool) error

func SendEmailViaMailgun

func SendEmailViaMailgun(to, subject, body string, async bool) error

func SendEmailViaMailjet

func SendEmailViaMailjet(to, subject, body string, async bool) error

func SendEmailViaSMTP

func SendEmailViaSMTP(to, subject, body string, async bool) error

func SyncNodeToConfig

func SyncNodeToConfig()

Types

type DatabaseSFTPAuthorization

type DatabaseSFTPAuthorization struct {
}

func (*DatabaseSFTPAuthorization) Validate

func (s *DatabaseSFTPAuthorization) Validate(username, password string) (perms *ssh.Permissions, err error)

type EmailService

type EmailService interface {
	SendEmail(to string, template string, data map[string]interface{}, async bool) error
}

func GetEmailService

func GetEmailService() EmailService

type Node

type Node struct {
	DB *gorm.DB
}

func (*Node) CallNode

func (ns *Node) CallNode(node *models.Node, method string, path string, body io.ReadCloser, headers http.Header) (*http.Response, error)

func (*Node) Create

func (ns *Node) Create(node *models.Node) error

func (*Node) Delete

func (ns *Node) Delete(id uint) error

func (*Node) Get

func (ns *Node) Get(id uint) (*models.Node, error)

func (*Node) GetAll

func (ns *Node) GetAll() ([]*models.Node, error)

func (*Node) OpenSocket

func (ns *Node) OpenSocket(node *models.Node, path string, writer http.ResponseWriter, request *http.Request) error

func (*Node) Update

func (ns *Node) Update(model *models.Node) error

type OAuth2

type OAuth2 struct {
	DB *gorm.DB
}

func (*OAuth2) Create

func (s *OAuth2) Create(request *models.Client) error

func (*OAuth2) Delete

func (s *OAuth2) Delete(clientId string) error

func (*OAuth2) Get

func (s *OAuth2) Get(clientId string) (*models.Client, error)

Get Gets a specific OAuth client, including the scopes it holds

func (*OAuth2) GetForUser

func (s *OAuth2) GetForUser(userId uint) ([]*models.Client, error)

GetForUser Gets all clients for a user

func (*OAuth2) Update

func (s *OAuth2) Update(request *models.Client) error

type Permission

type Permission struct {
	DB *gorm.DB
}

func (*Permission) GetForClient

func (ps *Permission) GetForClient(id uint) ([]*models.Permissions, error)

func (*Permission) GetForClientAndServer

func (ps *Permission) GetForClientAndServer(id uint, serverId *string) (*models.Permissions, error)

func (*Permission) GetForServer

func (ps *Permission) GetForServer(serverId string) ([]*models.Permissions, error)

func (*Permission) GetForUser

func (ps *Permission) GetForUser(id uint) ([]*models.Permissions, error)

func (*Permission) GetForUserAndServer

func (ps *Permission) GetForUserAndServer(userId uint, serverId *string) (*models.Permissions, error)

func (*Permission) Remove

func (ps *Permission) Remove(perms *models.Permissions) error

func (*Permission) UpdatePermissions

func (ps *Permission) UpdatePermissions(perms *models.Permissions) error

type Server

type Server struct {
	DB *gorm.DB
}

func (*Server) Create

func (ss *Server) Create(model *models.Server) error

func (*Server) Delete

func (ss *Server) Delete(id string) error

Delete a server by ID, This is _not_ ran in a transaction automatically to allow for more flexibility Callers should set the DB to be a transaction if needed (Because Gorm V2 has removed `RollbackUnlessCommitted1)

func (*Server) Get

func (ss *Server) Get(id string) (*models.Server, error)

func (*Server) Search

func (ss *Server) Search(searchCriteria ServerSearch) (records []*models.Server, total int64, err error)

func (*Server) Update

func (ss *Server) Update(model *models.Server) error

type ServerSearch

type ServerSearch struct {
	Username string
	NodeId   uint
	NodeName string
	Name     string
	PageSize uint
	Page     uint
}

type Session

type Session struct {
	DB *gorm.DB
}

func (*Session) CreateForClient

func (ss *Session) CreateForClient(client *models.Client) (string, error)

func (*Session) CreateForUser

func (ss *Session) CreateForUser(user *models.User) (string, error)

func (*Session) Expire

func (ss *Session) Expire(token string) error

func (*Session) Validate

func (ss *Session) Validate(token string) (*models.Session, error)

func (*Session) ValidateNode

func (ss *Session) ValidateNode(token string) (*models.Node, error)

type Template

type Template struct {
	DB *gorm.DB
}

func (*Template) AddRepo

func (t *Template) AddRepo(repo *models.TemplateRepo) error

func (*Template) Delete

func (t *Template) Delete(name string) error

func (*Template) DeleteRepo

func (t *Template) DeleteRepo(id uint) error

func (*Template) Get

func (t *Template) Get(repoId uint, name string) (*models.Template, error)

func (*Template) GetAllFromRepo

func (t *Template) GetAllFromRepo(repoId uint) ([]*models.Template, error)

func (*Template) GetLocalRepoId

func (*Template) GetLocalRepoId() uint

func (*Template) GetRepos

func (t *Template) GetRepos() ([]*models.TemplateRepo, error)

func (*Template) Save

func (t *Template) Save(template *models.Template) error

type TokenService

type TokenService interface {
	GetKeyFunc() jwt.Keyfunc
	GetTokenStore() jwkset.Storage
	GenerateRequest() (string, error)
	ValidateRequest(string) error
}

func NewTokenService

func NewTokenService() (TokenService, error)

type User

type User struct {
	DB *gorm.DB
}

func (*User) ChangePassword

func (us *User) ChangePassword(username string, newPass string) error

func (*User) Create

func (us *User) Create(user *models.User) error

func (*User) Delete

func (us *User) Delete(model *models.User) (err error)

func (*User) DisableOtp

func (us *User) DisableOtp(userId uint, token string) error

func (*User) Get

func (us *User) Get(username string) (*models.User, error)

func (*User) GetByEmail

func (us *User) GetByEmail(email string) (*models.User, error)

func (*User) GetById

func (us *User) GetById(id uint) (*models.User, error)

func (*User) GetOtpStatus

func (us *User) GetOtpStatus(userId uint) (enabled bool, err error)

func (*User) IsValidCredentials

func (us *User) IsValidCredentials(user *models.User, password string) bool

func (*User) Search

func (us *User) Search(usernameFilter, emailFilter string, pageSize, page uint) ([]*models.User, int64, error)

func (*User) StartOtpEnroll

func (us *User) StartOtpEnroll(userId uint) (secret string, imgStr string, err error)

func (*User) Update

func (us *User) Update(model *models.User) error

func (*User) ValidOtp

func (us *User) ValidOtp(email string, token string) (user *models.User, err error)

func (*User) ValidateLogin

func (us *User) ValidateLogin(email string, password string) (user *models.User, otpNeeded bool, err error)

func (*User) ValidateOtpEnroll

func (us *User) ValidateOtpEnroll(userId uint, token string) error

type UserSettings

type UserSettings struct {
	DB *gorm.DB
}

func (*UserSettings) GetAllForUser

func (uss *UserSettings) GetAllForUser(userId uint) (models.UserSettingsView, error)

func (*UserSettings) Update

func (uss *UserSettings) Update(model *models.UserSetting) error

Jump to

Keyboard shortcuts

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