services

package
v2.7.1 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: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(claims jwt.Claims) (string, error)

func GenerateOAuthForClient

func GenerateOAuthForClient(client *models.Client) (string, error)

func GenerateOAuthForNode

func GenerateOAuthForNode(nodeId uint) (string, error)

func GenerateSession

func GenerateSession(id uint) (string, error)

func GetPublicKey

func GetPublicKey() *ecdsa.PublicKey

func LoadEmailService

func LoadEmailService()

func ParseAllowedTags

func ParseAllowedTags(source string, allowed []string) []string

func ParseToken

func ParseToken(token string) (*pufferpanel.Token, error)

func SendEmailViaDebug added in v2.1.1

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

func SendEmailViaMailgun

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

func SendEmailViaMailjet added in v2.2.0

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

func SendEmailViaSMTP added in v2.1.1

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

func SyncNodeToConfig added in v2.6.0

func SyncNodeToConfig()

func ValidateTokenLoaded

func ValidateTokenLoaded()

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) Delete

func (o *OAuth2) Delete(client *models.Client) error

func (*OAuth2) Get

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

func (*OAuth2) GetForUser

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

func (*OAuth2) GetForUserAndServer added in v2.4.0

func (o *OAuth2) GetForUserAndServer(userId uint, serverId string) ([]*models.Client, error)

func (*OAuth2) Update

func (o *OAuth2) Update(client *models.Client) error

type Permission

type Permission struct {
	DB *gorm.DB
}

func (*Permission) GenerateOAuthForUser

func (ps *Permission) GenerateOAuthForUser(userId uint, serverId *string) (string, error)

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) (err 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 Template

type Template struct {
	DB *gorm.DB
}

func (*Template) Delete added in v2.2.0

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

func (*Template) Get

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

func (*Template) GetAll

func (t *Template) GetAll() (*models.Templates, error)

func (*Template) GetImportableTemplates added in v2.6.0

func (t *Template) GetImportableTemplates() ([]string, error)

func (*Template) ImportFromRepo

func (t *Template) ImportFromRepo(templateName string) error

func (*Template) ImportTemplate

func (t *Template) ImportTemplate(name string, template, readme io.Reader) error

func (*Template) Save

func (t *Template) Save(template *models.Template) 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 added in v2.3.0

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 added in v2.3.0

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) Login

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

func (*User) LoginOtp added in v2.3.0

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

func (*User) Search

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

func (*User) StartOtpEnroll added in v2.3.0

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

func (*User) Update

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

func (*User) ValidateOtpEnroll added in v2.3.0

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

type UserSettings added in v2.3.0

type UserSettings struct {
	DB *gorm.DB
}

func (*UserSettings) GetAllForUser added in v2.3.0

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

func (*UserSettings) Update added in v2.3.0

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