contracts

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AuthTokenCookieContextKeyStr = AuthTokenCookieContextKey("authToken")

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminLink struct {
	Title              string
	Section            string
	Icon               string
	Path               string
	HtmxAware          bool
	RequiredPermission string // Optional permission required to view this link
}

type AdminLinkService

type AdminLinkService interface {
	GetLinks(r *http.Request) *AdminSectionLinks
	AddLink(link AdminLink)
}

type AdminPanelViewModel

type AdminPanelViewModel struct {
	BaseViewModel
	OrgCount  int64
	UserCount int64
	RoleCount int64
	Recent    []RecentUser
}

type AdminRenderer

type AdminRenderer interface {
	Render(w http.ResponseWriter, r *http.Request, component templ.Component)
	AddStyle(css string)
}
type AdminSectionLinks struct {
	// contains filtered or unexported fields
}

func (*AdminSectionLinks) Add

func (asl *AdminSectionLinks) Add(link AdminLink)

func (*AdminSectionLinks) Iter

func (asl *AdminSectionLinks) Iter() iter.Seq2[string, []AdminLink]

Iterate the sections in the order they were added

type AuthToken

type AuthToken struct {
	UserId               int64  `json:"userId"`
	OrganizationId       int64  `json:"organizationId"`
	Email                string `json:"email"`
	TwoFactorRequired    bool   `json:"twoFactorRequired"`
	RequiresVerification bool   `json:"requiresVerification"`
	SoftExpiry           int64  `json:"softExpiry"`
	HardExpiry           int64  `json:"hardExpiry"`
}

func (*AuthToken) IsExpired

func (t *AuthToken) IsExpired() bool

func (*AuthToken) ToAgent

func (t *AuthToken) ToAgent() string

func (*AuthToken) ToUserIdentity

func (t *AuthToken) ToUserIdentity() UserIdentity

func (*AuthToken) Touch

func (t *AuthToken) Touch(updatedTime int64)

type AuthTokenCookie

type AuthTokenCookie interface {
	ToUserIdentity() UserIdentity
	IsExpired() bool
	Touch(unixSec int64)
}

type AuthTokenCookieContextKey

type AuthTokenCookieContextKey string

type AuthTokenCookieManager

type AuthTokenCookieManager interface {
	ClearAuthTokenCookie(w http.ResponseWriter)
	ReadAuthTokenCookie(r *http.Request) (bool, AuthToken, error)
	WriteAuthTokenCookie(w http.ResponseWriter, token AuthToken) error
	Middleware(handler http.Handler) http.Handler
	MiddlewareFunc(handler http.HandlerFunc) http.HandlerFunc
	TokenFromContext(ctx context.Context) (AuthToken, bool)
	IdentityFromContext(ctx context.Context) (UserIdentity, bool)
}

type BaseViewModel

type BaseViewModel struct {
	Fragment bool
	Links    *AdminSectionLinks
}

type CookieContextKey

type CookieContextKey string

type IdentityContextKey

type IdentityContextKey string

type LoginViewModel

type LoginViewModel struct {
	BaseViewModel
	Error string
}

type OrganizationFormViewModel

type OrganizationFormViewModel struct {
	BaseViewModel
	IsEdit       bool
	Organization *ubdata.Organization
	Error        string
	FieldErrors  map[string][]string
}

type OrganizationOverviewViewModel

type OrganizationOverviewViewModel struct {
	BaseViewModel
	ID         int64
	Name       string
	SystemName string
	Roles      []ubdata.ListRolesWithUserCountsRow
}

type OrganizationsPageViewModel

type OrganizationsPageViewModel struct {
	BaseViewModel
	Organizations []ubdata.Organization
	Query         string
}

type RecentUser

type RecentUser struct {
	ID          int64
	DisplayName string
	Email       string
	LastLogin   int64
}

type RoleFormViewModel

type RoleFormViewModel struct {
	BaseViewModel
	IsEdit        bool
	Role          *ubdata.RoleRow
	Organizations []ubdata.Organization
	SelectedOrg   int64
	Error         string
	FieldErrors   map[string][]string
}

type RoleOverviewViewModel

type RoleOverviewViewModel struct {
	BaseViewModel
	ID             int64
	Name           string
	SystemName     string
	OrganizationID int64
}

type RolePermissionsViewModel

type RolePermissionsViewModel struct {
	BaseViewModel
	RoleID      int64
	Permissions []string
	MemberSet   map[string]bool
}

type RoleUsersViewModel

type RoleUsersViewModel struct {
	BaseViewModel
	RoleID    int64
	Users     []ubdata.User
	MemberSet map[int64]bool
}

type Route

type Route struct {
	Path                  string
	RequiresPermission    string
	RequiresAuthenticated bool
	Api                   bool
	Func                  http.HandlerFunc
}

type TwoFactorViewModel

type TwoFactorViewModel struct {
	BaseViewModel
	UserID int64
	Error  string
}

type UserFormViewModel

type UserFormViewModel struct {
	BaseViewModel
	IsEdit      bool
	User        *ubdata.User
	Error       string
	FieldErrors map[string][]string
}

type UserIdentity

type UserIdentity struct {
	UserID         int64
	Email          string
	OrganizationID int64
}

func (*UserIdentity) ToAgent

func (u *UserIdentity) ToAgent() string

type UserOverviewViewModel

type UserOverviewViewModel struct {
	BaseViewModel
	ID                   int64
	DisplayName          string
	Email                string
	FirstName            string
	LastName             string
	Verified             bool
	Disabled             bool
	LastLogin            int64
	LoginCount           int64
	LastFailedLogin      int64
	FailedLoginAttempts  int64
	Organizations        []ubdata.Organization
	SelectedOrganization int64
}

type UserRolesViewModel

type UserRolesViewModel struct {
	BaseViewModel
	UserID    int64
	Roles     []ubdata.RoleRow
	MemberSet map[int64]bool
	OrgID     int64
}

type UsersPageViewModel

type UsersPageViewModel struct {
	BaseViewModel
	Users []ubdata.User
	Query string
}

Jump to

Keyboard shortcuts

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