utilitymodels

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: GPL-2.0 Imports: 4 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLDAPUser added in v0.3.0

func GetLDAPUser(db *gorm.DB) func() (string, func(foreignKey uint) any)

func GetLocalUser added in v0.3.0

func GetLocalUser(db *gorm.DB) func() (string, func(foreignKey uint) any)

Types

type Common

type Common struct {
	ID        uint      `gorm:"primarykey" json:"id"`
	CreatedAt time.Time `json:"-"`
	UpdatedAt time.Time `json:"-"`
}

type CommonID

type CommonID struct {
	ID uint `gorm:"primarykey" json:"id"`
}

type LDAPProvider added in v0.3.0

type LDAPProvider struct {
	Common
	Name               string
	Uri                string
	BindUser           *string
	BindPassword       *string
	SearchBase         string
	SearchFilter       *string
	AdminGroup         *string
	ForgotPasswordLink *string
}

type LDAPUser added in v0.3.0

type LDAPUser struct {
	Common
	LastLoginAt    sql.NullTime `json:"-" gorm:"default:null"` // This is only relevant if the session middleware is in use
	LDAPProviderID uint
	LDAPProvider   LDAPProvider
	Username       string
	DN             string
}

func (*LDAPUser) GetAuthModelIdentifier added in v0.3.0

func (user *LDAPUser) GetAuthModelIdentifier() (string, uint)

func (*LDAPUser) UpdateLastLogin added in v0.3.0

func (user *LDAPUser) UpdateLastLogin(echo.Context, *gorm.DB, time.Time)

type LocalUser added in v0.3.0

type LocalUser struct {
	Common
	LastLoginAt sql.NullTime `json:"-" gorm:"default:null"` // This is only relevant if the session middleware is in use
	Email       *string      `json:"email" gorm:"unique;default:null"`
	Username    string       `json:"username" gorm:"unique;not null"`
	Password    string       `json:"-" gorm:"not null"`
}

func (*LocalUser) GetAuthModelIdentifier added in v0.3.0

func (user *LocalUser) GetAuthModelIdentifier() (string, uint)

func (*LocalUser) UpdateLastLogin added in v0.3.0

func (user *LocalUser) UpdateLastLogin(c echo.Context, db *gorm.DB, loginTime time.Time)

type Session

type Session struct {
	Common
	AuthID     uint      `json:"auth_id" gorm:"not null"`
	AuthKey    string    `json:"auth_key" gorm:"not null"`
	SessionID  string    `json:"-" gorm:"not null;unique"`
	ValidUntil time.Time `json:"valid_until" gorm:"not null"`
}

Jump to

Keyboard shortcuts

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