user

package
v0.0.0-...-ca0f7d1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserWithSameIdentityExists            = errors.New("a user with the same identity already exists")
	ErrUserWithSameUnconfirmedIdentityExists = errors.New("a user with the same unconfirmed identity already exists")
	ErrUserNotFound                          = errors.New("user not found")
	ErrUserIsNotUpdated                      = errors.New("user is not updated")
	ErrUserWithSameNameExists                = errors.New("a user with the same name already exists")
	ErrUserNoIdentitiesFound                 = errors.New("there is no identities found for passed params")
	ErrUserSessionNotFound                   = errors.New("there is no sessions found for passed params")
	ErrUserNoExpiredRegistraions             = errors.New("there is no expired registration found")
	ErrUserIncorrectTokenToUse               = errors.New("token can not be used")
)

Functions

This section is empty.

Types

type ContinueWithOAuthParams

type ContinueWithOAuthParams struct {
	SocialNetworkType models.SocialNetworkType
	SocialID          string
	Email             string
	IsEmailVerified   bool
	FirstName         string
	LastName          string
	AvatarURL         string
	ClientID          models.ClientID
	ClientIP          string
}

type Manager

type Manager interface {
	// Auth
	CreateUserWithEmail(email, password string, clientID models.ClientID) error
	ConfirmRegistration(confirmationToken uuid.UUID) (*models.User, *models.SessionTokens, error)
	DeleteUserByID(userID uuid.UUID) error
	LoginWithEmailAndPassword(
		email, password, clientIP string,
		clientID models.ClientID,
	) (*models.User, *models.SessionTokens, error)
	ContinueWithOAuth(params ContinueWithOAuthParams) (*models.SessionTokens, error)
	RefreshSession(refreshToken uuid.UUID) (*models.SessionTokens, error)
	DeleteSessionBySessionID(sessionID uuid.UUID) error
	GetSessionByAccessToken(accessToken uuid.UUID) (*models.Session, error)

	// Used in cron jobs
	DeleteExpiredRegistrationConfirmations() error
	DeleteUsedTokens() error
	DeleteExpiredToken(tokenType models.TokenType) error
	DeleteExpiredSessions() error

	// Users get
	GetUserByID(userID uuid.UUID) (*models.User, error)
	GetUserByName(userName string) (*models.User, error)
	GetFullUser(userID uuid.UUID) (*models.User, error)

	// Own user updates
	UpdateAccountName(userID uuid.UUID, name string) error
}

type MockManager

type MockManager struct {
	mock.Mock
}

MockManager is an autogenerated mock type for the Manager type

func (*MockManager) ConfirmRegistration

func (_m *MockManager) ConfirmRegistration(confirmationToken uuid.UUID) (*models.User, *models.SessionTokens, error)

ConfirmRegistration provides a mock function with given fields: confirmationToken

func (*MockManager) ContinueWithOAuth

func (_m *MockManager) ContinueWithOAuth(params ContinueWithOAuthParams) (*models.SessionTokens, error)

ContinueWithOAuth provides a mock function with given fields: params

func (*MockManager) CreateUserWithEmail

func (_m *MockManager) CreateUserWithEmail(email string, password string, clientID models.ClientID) error

CreateUserWithEmail provides a mock function with given fields: email, password, clientID

func (*MockManager) DeleteExpiredRegistrationConfirmations

func (_m *MockManager) DeleteExpiredRegistrationConfirmations() error

DeleteExpiredRegistrationConfirmations provides a mock function with given fields:

func (*MockManager) DeleteExpiredSessions

func (_m *MockManager) DeleteExpiredSessions() error

DeleteExpiredSessions provides a mock function with given fields:

func (*MockManager) DeleteExpiredToken

func (_m *MockManager) DeleteExpiredToken(tokenType models.TokenType) error

DeleteExpiredToken provides a mock function with given fields: tokenType

func (*MockManager) DeleteSessionBySessionID

func (_m *MockManager) DeleteSessionBySessionID(sessionID uuid.UUID) error

DeleteSessionBySessionID provides a mock function with given fields: sessionID

func (*MockManager) DeleteUsedTokens

func (_m *MockManager) DeleteUsedTokens() error

DeleteUsedTokens provides a mock function with given fields:

func (*MockManager) DeleteUserByID

func (_m *MockManager) DeleteUserByID(userID uuid.UUID) error

DeleteUserByID provides a mock function with given fields: userID

func (*MockManager) GetFullUser

func (_m *MockManager) GetFullUser(userID uuid.UUID) (*models.User, error)

GetFullUser provides a mock function with given fields: userID

func (*MockManager) GetSessionByAccessToken

func (_m *MockManager) GetSessionByAccessToken(accessToken uuid.UUID) (*models.Session, error)

GetSessionByAccessToken provides a mock function with given fields: accessToken

func (*MockManager) GetUserByID

func (_m *MockManager) GetUserByID(userID uuid.UUID) (*models.User, error)

GetUserByID provides a mock function with given fields: userID

func (*MockManager) GetUserByName

func (_m *MockManager) GetUserByName(userName string) (*models.User, error)

GetUserByName provides a mock function with given fields: userName

func (*MockManager) LoginWithEmailAndPassword

func (_m *MockManager) LoginWithEmailAndPassword(email string, password string, clientIP string, clientID models.ClientID) (*models.User, *models.SessionTokens, error)

LoginWithEmailAndPassword provides a mock function with given fields: email, password, clientIP, clientID

func (*MockManager) RefreshSession

func (_m *MockManager) RefreshSession(refreshToken uuid.UUID) (*models.SessionTokens, error)

RefreshSession provides a mock function with given fields: refreshToken

func (*MockManager) UpdateAccountName

func (_m *MockManager) UpdateAccountName(userID uuid.UUID, name string) error

UpdateAccountName provides a mock function with given fields: userID, name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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