accounts

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Controller

type Controller interface {
	CreateAccount(c *gin.Context)
	GetAccount(c *gin.Context)
	UpdateAccount(c *gin.Context)
	UpdateAccountCredential(c *gin.Context)

	CreatePrincipal(c *gin.Context)
	GetPrincipal(c *gin.Context)
	DeletePrincipal(c *gin.Context)

	GetRole(c *gin.Context)
}

func NewController

func NewController(logger *zap.Logger, s Service) Controller

type DefaultController

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

func (DefaultController) CreateAccount

func (d DefaultController) CreateAccount(c *gin.Context)

func (DefaultController) CreatePrincipal

func (d DefaultController) CreatePrincipal(c *gin.Context)

func (DefaultController) DeleteAccount

func (d DefaultController) DeleteAccount(c *gin.Context)

func (DefaultController) DeletePrincipal

func (d DefaultController) DeletePrincipal(c *gin.Context)

func (DefaultController) GetAccount

func (d DefaultController) GetAccount(c *gin.Context)

func (DefaultController) GetPrincipal

func (d DefaultController) GetPrincipal(c *gin.Context)

func (DefaultController) GetRole

func (d DefaultController) GetRole(c *gin.Context)

func (DefaultController) UpdateAccount

func (d DefaultController) UpdateAccount(c *gin.Context)

func (DefaultController) UpdateAccountCredential

func (d DefaultController) UpdateAccountCredential(c *gin.Context)

type DefaultRepository

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

func (*DefaultRepository) CreateAccount

func (s *DefaultRepository) CreateAccount(username, hash, salt, email string) (account *models.Account, err error)

CreateAccount

func (*DefaultRepository) GetAccountById

func (s *DefaultRepository) GetAccountById(id uint64) (account *models.Account, err error)

func (*DefaultRepository) GetAccountByName

func (s *DefaultRepository) GetAccountByName(name string) (account *models.Account, err error)

func (*DefaultRepository) GetRoles

func (s *DefaultRepository) GetRoles(accountId uint64) (roles []*models.Role, err error)

func (*DefaultRepository) QueryCredential

func (s *DefaultRepository) QueryCredential(username string) (credential *models.Credential, err error)

func (*DefaultRepository) UpdateAccount

func (s *DefaultRepository) UpdateAccount(p *models.Account) (err error)

func (*DefaultRepository) UpdateCredential

func (s *DefaultRepository) UpdateCredential(u *models.Credential) (err error)

type DefaultService

type DefaultService struct {
	Repository Repository
	// contains filtered or unexported fields
}

func (*DefaultService) CreateAccount

func (s *DefaultService) CreateAccount(username, password, email string) (account *models.Account, err error)

func (*DefaultService) GetAccount

func (s *DefaultService) GetAccount(name string) (account *models.Account, err error)

func (*DefaultService) GetAccountById

func (s *DefaultService) GetAccountById(id uint64) (account *models.Account, err error)

func (*DefaultService) GetRoleById

func (s *DefaultService) GetRoleById(accountId uint64) (roles []*models.Role, err error)

func (*DefaultService) UpdateAccount

func (s *DefaultService) UpdateAccount(account *models.Account, nickname, email, gender, locale string) (*models.Account, error)

func (*DefaultService) UpdateCredential

func (s *DefaultService) UpdateCredential(username, oldPassword, newPassword string) (res bool, err error)

func (*DefaultService) VerifyCredential

func (s *DefaultService) VerifyCredential(username, password string) (isValid bool, err error)

type InitAccountGroupFn

type InitAccountGroupFn func(r *gin.RouterGroup)

func CreateInitControllersFn

func CreateInitControllersFn(ac Controller) InitAccountGroupFn

type Repository

type Repository interface {
	GetAccountByName(name string) (account *models.Account, err error)
	GetAccountById(id uint64) (account *models.Account, err error)
	CreateAccount(name, hash, salt, email string) (u *models.Account, err error)
	UpdateAccount(p *models.Account) (err error)

	UpdateCredential(u *models.Credential) (err error)
	QueryCredential(username string) (u *models.Credential, err error)

	GetRoles(accountId uint64) (roles []*models.Role, err error)
}

func NewRepository

func NewRepository(logger *zap.Logger, db *gorm.DB) Repository

type Service

type Service interface {
	GetAccount(name string) (account *models.Account, err error)
	GetAccountById(id uint64) (account *models.Account, err error)
	UpdateAccount(account *models.Account, nickname, email, gender, locale string) (*models.Account, error)
	CreateAccount(username, password, email string) (account *models.Account, err error)

	UpdateCredential(username, oldPassword, newPassword string) (res bool, err error)
	VerifyCredential(username, password string) (isValid bool, err error)

	GetRoleById(accountId uint64) (roles []*models.Role, err error)
}

func NewService

func NewService(logger *zap.Logger, Repository Repository) Service

Jump to

Keyboard shortcuts

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