admin

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthInfo added in v0.9.0

type AuthInfo struct {
	UserID   int64  `json:"user_id"`
	Username string `json:"username"`
	Role     string `json:"role"`
	IsAdmin  bool   `json:"is_admin"`
}

AuthInfo carries authenticated user data through request context.

func UserFromContext added in v0.9.0

func UserFromContext(ctx context.Context) *AuthInfo

UserFromContext extracts the AuthInfo from a request context. Returns nil if the user is not authenticated.

type Server

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

Server provides HTTP handlers for the admin API and templ-rendered pages.

func New

func New(store config.Store, authStore auth.AuthStore, engine *auth.PolicyEngine, mem memory.Provider, db *sql.DB, linkCodes *auth.LinkCodeStore, poolManager *agent.PoolManager, pluginHost *pluginhost.Host) *Server

New creates an admin server with all API routes mounted. The linkCodes store is shared with channel bots so codes generated in the admin panel can be consumed by channel handlers.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the HTTP handler with CORS, JSON, and auth middleware applied.

func (*Server) LinkCodes added in v0.9.0

func (s *Server) LinkCodes() *auth.LinkCodeStore

LinkCodes returns the link code store for use by channel handlers.

Directories

Path Synopsis
ui
templ: version: v0.3.1001
templ: version: v0.3.1001
pages
templ: version: v0.3.1001
templ: version: v0.3.1001

Jump to

Keyboard shortcuts

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