user

package
v0.0.0-...-9471f5d Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Mgr is the global project manager
	Mgr = New()
)

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// Get get user by user id
	Get(ctx context.Context, id int) (*commonmodels.User, error)
	// GetByName get user by username, it will return an error if the user does not exist
	GetByName(ctx context.Context, username string) (*commonmodels.User, error)
	// List users according to the query
	List(ctx context.Context, query *q.Query, options ...models.Option) (commonmodels.Users, error)
	// Count counts the number of users according to the query
	Count(ctx context.Context, query *q.Query, options ...models.Option) (int64, error)
	// Create creates the user, the password of input should be plaintext
	Create(ctx context.Context, user *commonmodels.User) (int, error)
	// Delete deletes the user by updating user's delete flag and update the name and Email
	Delete(ctx context.Context, id int) error
	// DeleteGDPR deletes the user by updating user's delete flag and replace identifiable data with its crc
	DeleteGDPR(ctx context.Context, id int) error
	// SetSysAdminFlag sets the system admin flag of the user in local DB
	SetSysAdminFlag(ctx context.Context, id int, admin bool) error
	// UpdateProfile updates the user's profile
	UpdateProfile(ctx context.Context, user *commonmodels.User, col ...string) error
	// UpdatePassword updates user's password
	UpdatePassword(ctx context.Context, id int, newPassword string) error
	// MatchLocalPassword tries to match the record in DB based on the input, the first return value is
	// the user model corresponding to the entry in DB
	MatchLocalPassword(ctx context.Context, username, password string) (*commonmodels.User, error)
	// Onboard will check if a user exists in user table, if not insert the user and
	// put the id in the pointer of user model, if it does exist, return the user's profile.
	// This is used for ldap and uaa authentication, such the user can have an ID in Harbor.
	Onboard(ctx context.Context, user *commonmodels.User) error
	// GenerateCheckSum generates truncated crc32 checksum from a given string
	GenerateCheckSum(in string) string
}

Manager is used for user management

func New

func New() Manager

New returns a default implementation of Manager

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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