localusers

package
v0.0.0-...-f34f428 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRepositoryProvider

func InitRepositoryProvider(databaseProvider string)

InitRepositoryProvider - One time init for the given DB Provider

Types

type PgsqlLocalUsersRepository

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

PgsqlLocalUsersRepository is a PostgreSQL-backed local users repository

func (*PgsqlLocalUsersRepository) AddLocalUser

func (p *PgsqlLocalUsersRepository) AddLocalUser(user interfaces.LocalUser) error

AddLocalUser - Add a new local user to the datastore. Email is optional

func (*PgsqlLocalUsersRepository) FindLastLoginTime

func (p *PgsqlLocalUsersRepository) FindLastLoginTime(userGUID string) (time.Time, error)

FindLastLoginTime selects the last_login field from the local_users table in the db, for the given user.

func (*PgsqlLocalUsersRepository) FindPasswordHash

func (p *PgsqlLocalUsersRepository) FindPasswordHash(userGUID string) ([]byte, error)

FindPasswordHash returns the password hash from the datastore, for the given user

func (*PgsqlLocalUsersRepository) FindUser

func (p *PgsqlLocalUsersRepository) FindUser(userGUID string) (interfaces.LocalUser, error)

FindUser finds and returns meatdata for the given user

func (*PgsqlLocalUsersRepository) FindUserGUID

func (p *PgsqlLocalUsersRepository) FindUserGUID(username string) (string, error)

FindUserGUID returns the user GUID from the datastore for the given username.

func (*PgsqlLocalUsersRepository) FindUserScope

func (p *PgsqlLocalUsersRepository) FindUserScope(userGUID string) (string, error)

FindUserScope selects the user_scope field from the local_users table in the db, for the given user.

func (*PgsqlLocalUsersRepository) UpdateLastLoginTime

func (p *PgsqlLocalUsersRepository) UpdateLastLoginTime(userGUID string, loginTime time.Time) error

UpdateLastLoginTime called when a local user logs in. It updates the last_login timestamp field in the local_users table for the given user.

func (*PgsqlLocalUsersRepository) UpdateLocalUser

func (p *PgsqlLocalUsersRepository) UpdateLocalUser(user interfaces.LocalUser) error

type Repository

type Repository interface {
	AddLocalUser(user interfaces.LocalUser) error
	UpdateLocalUser(user interfaces.LocalUser) error
	FindPasswordHash(userGUID string) ([]byte, error)
	FindUserGUID(username string) (string, error)
	FindUserScope(userGUID string) (string, error)
	FindUser(userGUID string) (interfaces.LocalUser, error)
	UpdateLastLoginTime(userGUID string, loginTime time.Time) error
	FindLastLoginTime(userGUID string) (time.Time, error)
}

Repository is an application of the repository pattern for storing local users

func NewPgsqlLocalUsersRepository

func NewPgsqlLocalUsersRepository(dcp *sql.DB) (Repository, error)

NewPgsqlLocalUsersRepository - get a reference to the local users data source

Jump to

Keyboard shortcuts

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