superusers

package
v0.0.0-...-ff5c026 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Provide readonly access to superuser config specified during creation Thus the API doesn't allow creation of new superuser from it, nor does it allow deletion.

Index

Constants

View Source
const (
	DefaultSuperAdmin = "superadmin"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SuperUser

type SuperUser struct {
	// SuperUser has names as opposed to email
	Name string
	// HashedPassword contains hashed password
	HashedPassword string
	// Avatar is a base64
	Avatar string
}

type SuperUserConfig

type SuperUserConfig struct {
	SuperUsers []*SuperUser `json:"super_users" yaml:"super_users" mapstructure:"super_users"`
}

type SuperUserIO

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

SuperUserIO queries superusers from a config under yaml / json format note that passwords are and should be encrypted

func NewSuperUserDAO

func NewSuperUserDAO(superAdminFilePath string, logger logging.Logger) *SuperUserIO

NewSuperUserDAO creates SuperUserIO it checks whether or not the file exists, if it does it opens it readonly if it doesn't it creates a file containing default superuser and its password in a hashed format.

func (*SuperUserIO) Get

func (s *SuperUserIO) Get(ctx context.Context, name string) (*rpc.Account, error)

Get Superuser based on its / his / her name. will return SuperUser object and error if any

func (*SuperUserIO) GetFilepath

func (s *SuperUserIO) GetFilepath() string

func (*SuperUserIO) List

func (s *SuperUserIO) List(ctx context.Context, nameLike string) ([]*rpc.Account, error)

Jump to

Keyboard shortcuts

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