user

package
v0.0.0-...-606dd78 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocalUserDomain = "local"
)

Variables

View Source
var (
	// AdminUserName is the default username that we give to the default admin
	// user that is created as part of every Juju bootstrap.
	AdminUserName = Name{/* contains filtered or unexported fields */}
)

Functions

func IsValidName

func IsValidName(name string) bool

IsValidName returns whether the given name is a valid user name string.

Types

type Name

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

Name represents the identity of a user.

func NameFromTag

func NameFromTag(tag userNameTag) Name

NameFromTag generates a Name from a tag.

func NewName

func NewName(name string) (Name, error)

NewName validates the name and returns a new Name object. If the name is not valid an error satisfying errors.NotValid will be returned.

func (Name) Domain

func (n Name) Domain() string

Domain returns the user domain. Users in the local database are from the LocalDomain. Other users are considered 'remote' users.

func (Name) IsLocal

func (n Name) IsLocal() bool

IsLocal indicates if the username is a local or external username.

func (Name) IsZero

func (n Name) IsZero() bool

IsZero return true if the struct is uninitiated.

func (Name) Name

func (n Name) Name() string

Name returns the full username.

func (Name) String

func (n Name) String() string

String returns the full username.

type UUID

type UUID string

UUID is a unique identifier for a user.

func NewUUID

func NewUUID() (UUID, error)

NewUUID returns a new UUID.

func (UUID) String

func (u UUID) String() string

String returns the UUID as a string.

func (UUID) Validate

func (u UUID) Validate() error

Validate returns an error if the UUID is invalid. The error returned satisfies errors.NotValid.

type User

type User struct {
	// UUID is the unique identifier for the user.
	UUID UUID

	// Name is the username of the user.
	Name Name

	// DisplayName is a user-friendly name represent the user as.
	DisplayName string

	// CreatorUUID is the associated user that created this user.
	CreatorUUID UUID

	// CreatorName is the name of the user that created this user.
	CreatorName Name

	// CreatedAt is the time that the user was created at.
	CreatedAt time.Time

	// LastLogin is the last time the user logged in.
	LastLogin time.Time

	// Disabled is true if the user is disabled.
	Disabled bool
}

User represents a user in the system.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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