usersdb

package module
v0.0.0-...-8f6edbe Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbHost              = "meep-postgis.default.svc.cluster.local"
	DbPort              = "5432"
	DbUser              = ""
	DbPassword          = ""
	DbDefault           = "postgres"
	DbMaxRetryCount int = 2
)

DB Config

View Source
const (
	RoleUser  = "user"
	RoleAdmin = "admin"
)
View Source
const (
	ProviderLocal = "local"
)
View Source
const (
	UsersTable = "users"
)

DB Table Names

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

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

Connector - Implements a Postgis SQL DB connector

func NewConnector

func NewConnector(name, user, pwd, host, port string) (pc *Connector, err error)

NewConnector - Creates and initializes a Postgis connector

func (*Connector) AuthenticateUser

func (pc *Connector) AuthenticateUser(provider string, username string, password string) (authenticated bool, err error)

AuthenticateUser - returns true or false if credentials are OK

func (*Connector) CreateDb

func (pc *Connector) CreateDb(name string) (err error)

CreateDb -- Create new DB with provided name

func (*Connector) CreateTables

func (pc *Connector) CreateTables() (err error)

func (*Connector) CreateUser

func (pc *Connector) CreateUser(provider string, username string, password string, role string, sboxname string) (err error)

CreateUser - Create new user

func (*Connector) DeleteTable

func (pc *Connector) DeleteTable(tableName string) (err error)

DeleteTable - Delete table with provided name

func (*Connector) DeleteTables

func (pc *Connector) DeleteTables() (err error)

DeleteTables - Delete all tables

func (*Connector) DeleteUser

func (pc *Connector) DeleteUser(provider string, username string) (err error)

DeleteUser - Delete user entry

func (*Connector) DeleteUsers

func (pc *Connector) DeleteUsers() (err error)

DeleteAllUsers - Delete all users entries

func (*Connector) GetUser

func (pc *Connector) GetUser(provider string, username string) (user *User, err error)

GetUser - Get user information

func (*Connector) GetUserKey

func (pc *Connector) GetUserKey(provider string, username string) (key string)

GetUserKey - Get provider-specific user key

func (*Connector) GetUsers

func (pc *Connector) GetUsers() (userMap map[string]*User, err error)

GetAllUsers - Get All users

func (*Connector) IsValidUser

func (pc *Connector) IsValidUser(provider string, username string) (valid bool, err error)

IsValidUser - does if user exists

func (*Connector) UpdateUser

func (pc *Connector) UpdateUser(provider string, username string, password string, role string, sboxname string) (err error)

UpdateUser - Update existing user

type User

type User struct {
	Id       string
	Provider string
	Username string
	Password string
	Role     string
	Sboxname string
}

Jump to

Keyboard shortcuts

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