appcontext

package
v0.1868.126 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package appcontext provides functionality to pass data in contexts through the lifetime of a web request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithData added in v0.1339.0

func ContextWithData(ctx context.Context, appData Data) context.Context

func ContextWithSession added in v0.1339.0

func ContextWithSession(ctx context.Context, data *Session) context.Context

Types

type Data added in v0.1339.0

type Data struct {
	ActorType         actor.Type
	AttorneyUID       actoruid.UID
	CanGoBack         bool
	CookieConsentSet  bool
	CsrfToken         string
	HasLpas           bool
	HideLoginNav      bool
	Lang              localize.Lang
	LoginSessionEmail string
	Localizer         localize.Localizer
	LpaID             string
	Page              string
	Path              string
	Query             url.Values
	SessionID         string
	SupporterData     *SupporterData
}

func DataFromContext added in v0.1339.0

func DataFromContext(ctx context.Context) Data

func (Data) EncodeQuery added in v0.1339.0

func (d Data) EncodeQuery() string

func (Data) IsAdmin added in v0.1339.0

func (d Data) IsAdmin() bool

func (Data) IsAttorneyType added in v0.1339.0

func (d Data) IsAttorneyType() bool

func (Data) IsCertificateProvider added in v0.1339.0

func (d Data) IsCertificateProvider() bool

func (Data) IsDonor added in v0.1339.0

func (d Data) IsDonor() bool

func (Data) IsReplacementAttorney added in v0.1339.0

func (d Data) IsReplacementAttorney() bool

func (Data) IsTrustCorporation added in v0.1339.0

func (d Data) IsTrustCorporation() bool

func (Data) Redirect added in v0.1339.0

func (d Data) Redirect(w http.ResponseWriter, r *http.Request, url string) error

type Session added in v0.1339.0

type Session struct {
	SessionID string
	LpaID     string

	// if a supporter
	Email          string
	OrganisationID string
}

func SessionFromContext added in v0.1339.0

func SessionFromContext(ctx context.Context) (*Session, error)

type SessionMissingError

type SessionMissingError struct{}

func (SessionMissingError) Error

func (s SessionMissingError) Error() string

type SupporterData added in v0.1339.0

type SupporterData struct {
	LpaType              lpadata.LpaType
	DonorFullName        string
	OrganisationName     string
	IsManageOrganisation bool
	Permission           supporterdata.Permission
	LoggedInSupporterID  string
}

Jump to

Keyboard shortcuts

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