admin

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 51 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) CredentialsService added in v0.15.0

func (s *Server) CredentialsService() *credentials.Service

CredentialsService returns the shared credentials service. Used by callers that need to wire in the runner invalidator or access the credentials tool from outside the admin package.

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.

func (*Server) SetVaultRecipient added in v0.15.0

func (s *Server) SetVaultRecipient(r *age.X25519Recipient)

SetVaultRecipient sets the master age recipient so that new users created via web registration receive an age keypair. Call before serving requests. If not set (nil), vault key generation is skipped for new users.

func (*Server) SetVaultService added in v0.15.0

func (s *Server) SetVaultService(svc *vault.Service)

SetVaultService wires the vault service into the admin server. Call before serving requests. If not set (nil), vault API endpoints return 503 Service Unavailable.

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