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
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 ¶
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.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.