users

package
v0.8.10 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MaxFailed uint32 = 5
View Source
const UserCreated = schema.Created
View Source
const UserDeleted = schema.Deleted
View Source
const UserLocked = schema.UserLocked
View Source
const UserModified = schema.Modified
View Source
const UserName = schema.UserName
View Source
const UserOTP = schema.UserOTP
View Source
const UserOTPKey = schema.UserOTPKey
View Source
const UserPassword = schema.UserPassword
View Source
const UserRole = schema.UserRole
View Source
const UserStatus = schema.Status
View Source
const UserUID = schema.UserUID

Variables

This section is empty.

Functions

func CanAdd added in v0.8.3

func CanAdd[T TAuthable](a auth.OpAuth, u T) error

func CanDelete added in v0.8.3

func CanDelete[T TAuthable](a auth.OpAuth, u T) error

func CanUpdate added in v0.8.3

func CanUpdate[T TAuthable](a auth.OpAuth, u T, field string, value any) error

func CanView added in v0.8.3

func CanView[T TAuthable](a auth.OpAuth, u T, field string, value any) error

Types

type TAuthable added in v0.8.3

type TAuthable interface {
	User | *User

	AsRuleEntity() (string, any)
	CacheKey() string
}

type User

type User struct {
	catalog.CatalogUser
	// contains filtered or unexported fields
}

func (User) AsObjects

func (u User) AsObjects(a *auth.Authorizator) []schema.Object

func (User) AsRuleEntity

func (u User) AsRuleEntity() (string, interface{})

func (User) CacheKey added in v0.8.10

func (u User) CacheKey() string

func (User) IsDeleted

func (u User) IsDeleted() bool

func (User) IsValid

func (u User) IsValid() bool

func (User) Locked added in v0.8.3

func (u User) Locked() bool

func (User) OTPKey added in v0.8.3

func (u User) OTPKey() string

func (User) Password

func (u User) Password() ([]byte, string)

func (User) Role

func (u User) Role() string

func (User) Status

func (u User) Status() types.Status

func (User) String

func (u User) String() string

type Users

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

func NewUsers

func NewUsers() Users

func (*Users) AsObjects

func (uu *Users) AsObjects(a *auth.Authorizator) []schema.Object

func (Users) Clone

func (uu Users) Clone() Users

func (*Users) Create

func (uu *Users) Create(a *auth.Authorizator, oid schema.OID, value string, dbc db.DBC) ([]schema.Object, error)

func (*Users) Delete

func (uu *Users) Delete(a *auth.Authorizator, oid schema.OID, dbc db.DBC) ([]schema.Object, error)

func (Users) HasAdmin added in v0.8.9

func (uu Users) HasAdmin(role string) bool

func (*Users) Load

func (uu *Users) Load(blob json.RawMessage) error

func (*Users) MakeAdminUser added in v0.8.9

func (uu *Users) MakeAdminUser(name string, uid string, pwd string, role string, dbc db.DBC) error

func (Users) Print

func (uu Users) Print()

func (*Users) RevokeOTP added in v0.8.3

func (uu *Users) RevokeOTP(a *auth.Authorizator, uid string, dbc db.DBC) ([]schema.Object, error)

func (Users) Save

func (uu Users) Save() (json.RawMessage, error)

func (*Users) SetOTP added in v0.8.3

func (uu *Users) SetOTP(a *auth.Authorizator, uid, secret string, dbc db.DBC) ([]schema.Object, error)

func (*Users) SetPassword

func (uu *Users) SetPassword(a *auth.Authorizator, uid, pwd string, dbc db.DBC) ([]schema.Object, error)

func (*Users) Sweep

func (uu *Users) Sweep(retention time.Duration)

func (*Users) Update

func (uu *Users) Update(a *auth.Authorizator, oid schema.OID, value string, dbc db.DBC) ([]schema.Object, error)

func (Users) User

func (uu Users) User(uid string) (auth.IUser, bool)

func (*Users) UserLogin added in v0.8.3

func (uu *Users) UserLogin(a *auth.Authorizator, uid string, err error, dbc db.DBC)

func (Users) Validate

func (uu Users) Validate() error

Jump to

Keyboard shortcuts

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