Documentation
¶
Index ¶
- Variables
- func EnsureFirstUserIsAdmin(ctx context.Context, userID, orgID xid.ID, ...) error
- func EnsureFirstUserIsSuperAdmin(ctx context.Context, userID, orgID xid.ID, ...) error
- func RegisterDashboardRoles(registry *rbac.RoleRegistry) error
- func RenderNavigationItems(items []ui.NavigationItem, basePath string, currentApp *app.App, ...) []g.Node
- func SetupDefaultPolicies(rbacSvc *rbac.Service) error
- type ActivityItem
- type CSRFProtector
- func (c *CSRFProtector) CleanupExpiredTokens()
- func (c *CSRFProtector) GenerateToken(sessionID string) (string, error)
- func (c *CSRFProtector) InvalidateToken(token string)
- func (c *CSRFProtector) RotateSecret() error
- func (c *CSRFProtector) Stats() map[string]any
- func (c *CSRFProtector) ValidateToken(token, sessionID string) bool
- type Config
- type DashboardError
- type DashboardErrorResponse
- type DashboardHTMLResponse
- type DashboardLoginResponse
- type DashboardPermissions
- func (d *DashboardPermissions) CanAccess() bool
- func (d *DashboardPermissions) CanManageSessions() bool
- func (d *DashboardPermissions) CanManageUsers() bool
- func (d *DashboardPermissions) CanViewAuditLogs() bool
- func (d *DashboardPermissions) CanViewSessions() bool
- func (d *DashboardPermissions) CanViewUsers() bool
- type DashboardPingResponse
- type DashboardStaticResponse
- type DashboardStats
- type DashboardStatusResponse
- type ErrorResponse
- type ExtensionRegistry
- func (r *ExtensionRegistry) Get(id string) (ui.DashboardExtension, bool)
- func (r *ExtensionRegistry) GetAllRoutes() []ui.Route
- func (r *ExtensionRegistry) GetDashboardWidgets() []ui.DashboardWidget
- func (r *ExtensionRegistry) GetHandler() *Handler
- func (r *ExtensionRegistry) GetNavigationItems(position ui.NavigationPosition, enabledPlugins map[string]bool) []ui.NavigationItem
- func (r *ExtensionRegistry) GetSettingsPages(enabledPlugins map[string]bool) []ui.SettingsPage
- func (r *ExtensionRegistry) GetSettingsSections() []ui.SettingsSection
- func (r *ExtensionRegistry) List() []ui.DashboardExtension
- func (r *ExtensionRegistry) Register(ext ui.DashboardExtension) error
- func (r *ExtensionRegistry) RegisterBridgeFunctions(ext ui.DashboardExtension, log forge.Logger) error
- func (r *ExtensionRegistry) SetBridge(b *bridge.Bridge)
- func (r *ExtensionRegistry) SetHandler(h *Handler)
- type Handler
- func (h *Handler) GetBasePath() string
- func (h *Handler) GetCSRFToken(c forge.Context) string
- func (h *Handler) GetCurrentApp(c forge.Context) (*app.App, error)
- func (h *Handler) GetCurrentEnvironment(c forge.Context, appID xid.ID) (*environment.Environment, error)
- func (h *Handler) GetEnabledPlugins() map[string]bool
- func (h *Handler) GetUserApps(c forge.Context, userID xid.ID) ([]*app.App, error)
- func (h *Handler) GetUserEnvironments(c forge.Context, appID xid.ID) ([]*environment.Environment, error)
- func (h *Handler) GetUserFromContext(c forge.Context) *user.User
- func (h *Handler) RenderSettingsPage(c forge.Context, pageID string, content g.Node) error
- func (h *Handler) RenderWithBaseLayout(c forge.Context, pageData components.PageData, content g.Node) error
- func (h *Handler) RenderWithHeaderLayout(c forge.Context, pageData components.PageData, content g.Node) error
- func (h *Handler) RenderWithLayout(c forge.Context, pageData components.PageData, content g.Node) error
- func (h *Handler) RenderWithSidebarLayout(c forge.Context, pageData components.PageData, content g.Node) error
- func (h *Handler) ServeStatic(c forge.Context) error
- type MessageResponse
- type Permission
- type PermissionBuilder
- func (b *PermissionBuilder) Can(action, resource string) bool
- func (b *PermissionBuilder) CanCreate(resource string) bool
- func (b *PermissionBuilder) CanDelete(resource string) bool
- func (b *PermissionBuilder) CanEdit(resource string) bool
- func (b *PermissionBuilder) CanView(resource string) bool
- func (b *PermissionBuilder) Dashboard() *DashboardPermissions
- func (b *PermissionBuilder) HasRole(roleName string) bool
- func (b *PermissionBuilder) IsAdmin() bool
- func (b *PermissionBuilder) IsOwner() bool
- func (b *PermissionBuilder) IsSuperAdmin() bool
- type PermissionChecker
- func (p *PermissionChecker) Can(ctx context.Context, userID xid.ID, action, resource string) bool
- func (p *PermissionChecker) CanAll(ctx context.Context, userID xid.ID, permissions ...Permission) bool
- func (p *PermissionChecker) CanAny(ctx context.Context, userID xid.ID, permissions ...Permission) bool
- func (p *PermissionChecker) For(ctx context.Context, userID xid.ID) *PermissionBuilder
- func (p *PermissionChecker) HasAnyRole(ctx context.Context, userID xid.ID, roleNames ...string) bool
- func (p *PermissionChecker) HasRole(ctx context.Context, userID xid.ID, roleName string) bool
- func (p *PermissionChecker) InvalidateUserCache(userID xid.ID)
- type Plugin
- func (p *Plugin) AppContext() func(func(forge.Context) error) func(forge.Context) error
- func (p *Plugin) AuditLog() func(func(forge.Context) error) func(forge.Context) error
- func (p *Plugin) BridgeContextMiddleware() http.Handler
- func (p *Plugin) CSRF() func(func(forge.Context) error) func(forge.Context) error
- func (p *Plugin) Dependencies() []string
- func (p *Plugin) EnvironmentContext() func(func(forge.Context) error) func(forge.Context) error
- func (p *Plugin) ForgeUIApp() *forgeui.App
- func (p *Plugin) ForgeUIBridge() *bridge.Bridge
- func (p *Plugin) ID() string
- func (p *Plugin) Init(authInstance core.Authsome) error
- func (p *Plugin) Migrate() error
- func (p *Plugin) PlatformOrgContext() func(func(forge.Context) error) func(forge.Context) error
- func (p *Plugin) RateLimit() func(func(forge.Context) error) func(forge.Context) error
- func (p *Plugin) RegisterHooks(hooks *hooks.HookRegistry) error
- func (p *Plugin) RegisterRoles(registry any) error
- func (p *Plugin) RegisterRoutes(router forge.Router) error
- func (p *Plugin) RegisterServiceDecorators(services *registry.ServiceRegistry) error
- func (p *Plugin) RequireAdmin() func(func(forge.Context) error) func(forge.Context) error
- func (p *Plugin) RequireAuth() func(func(forge.Context) error) func(forge.Context) error
- type PluginItem
- type PluginOption
- func WithDefaultConfig(cfg Config) PluginOption
- func WithDefaultTheme(theme string) PluginOption
- func WithEnableSignup(enabled bool) PluginOption
- func WithLockoutDuration(minutes int) PluginOption
- func WithMaxLoginAttempts(max int) PluginOption
- func WithRequireEmailVerification(required bool) PluginOption
- func WithSessionDuration(hours int) PluginOption
- type StatusItem
- type StatusResponse
- type SuccessResponse
Constants ¶
This section is empty.
Variables ¶
var ( // ErrExtensionAlreadyRegistered indicates an extension with the same ID is already registered. ErrExtensionAlreadyRegistered = &DashboardError{ Code: "extension_already_registered", Message: "dashboard extension already registered", } )
Functions ¶
func EnsureFirstUserIsAdmin ¶
func EnsureFirstUserIsAdmin(ctx context.Context, userID, orgID xid.ID, userRoleRepo rbac.UserRoleRepository, roleRepo rbac.RoleRepository) error
EnsureFirstUserIsAdmin assigns admin role to the first user DEPRECATED: Use EnsureFirstUserIsSuperAdmin for first user setup.
func EnsureFirstUserIsSuperAdmin ¶
func EnsureFirstUserIsSuperAdmin(ctx context.Context, userID, orgID xid.ID, userRoleRepo rbac.UserRoleRepository, roleRepo rbac.RoleRepository) error
EnsureFirstUserIsSuperAdmin assigns superadmin role to the first user This makes them the platform owner with full system access.
func RegisterDashboardRoles ¶
func RegisterDashboardRoles(registry *rbac.RoleRegistry) error
RegisterDashboardRoles registers dashboard-specific roles in the RoleRegistry This extends the default platform roles with dashboard-specific permissions Supports override semantics - plugins can modify other plugins' roles.
func RenderNavigationItems ¶
func RenderNavigationItems(items []ui.NavigationItem, basePath string, currentApp *app.App, activePage string) []g.Node
RenderNavigationItems renders navigation items as gomponents nodes.
func SetupDefaultPolicies ¶
SetupDefaultPolicies creates default RBAC policies for the dashboard Role hierarchy: superadmin > owner > admin > member This is kept for backward compatibility and immediate policy loading The role bootstrap system will persist these roles to the database.
Types ¶
type ActivityItem ¶
type ActivityItem struct {
Title string
Description string
Time string
Type string // success, warning, error, info
}
ActivityItem represents a recent activity entry.
type CSRFProtector ¶
type CSRFProtector struct {
// contains filtered or unexported fields
}
CSRFProtector provides production-grade CSRF protection.
func NewCSRFProtector ¶
func NewCSRFProtector() (*CSRFProtector, error)
NewCSRFProtector creates a new CSRF protector with a random secret.
func (*CSRFProtector) CleanupExpiredTokens ¶
func (c *CSRFProtector) CleanupExpiredTokens()
CleanupExpiredTokens manually triggers cleanup of expired tokens.
func (*CSRFProtector) GenerateToken ¶
func (c *CSRFProtector) GenerateToken(sessionID string) (string, error)
GenerateToken generates a new CSRF token for a session Format: base64(randomBytes) + "." + base64(hmac(randomBytes + sessionID)).
func (*CSRFProtector) InvalidateToken ¶
func (c *CSRFProtector) InvalidateToken(token string)
InvalidateToken removes a token from the store.
func (*CSRFProtector) RotateSecret ¶
func (c *CSRFProtector) RotateSecret() error
RotateSecret generates a new CSRF secret Should be called periodically for enhanced security.
func (*CSRFProtector) Stats ¶
func (c *CSRFProtector) Stats() map[string]any
Stats returns statistics about the CSRF token store.
func (*CSRFProtector) ValidateToken ¶
func (c *CSRFProtector) ValidateToken(token, sessionID string) bool
ValidateToken validates a CSRF token against a session.
type Config ¶
type Config struct {
// EnableSignup allows new users to sign up for dashboard access
EnableSignup bool `json:"enableSignup"`
// RequireEmailVerification requires email verification for new signups
RequireEmailVerification bool `json:"requireEmailVerification"`
// SessionDuration sets the duration for dashboard sessions in hours
SessionDuration int `json:"sessionDuration"`
// MaxLoginAttempts sets the maximum login attempts before lockout
MaxLoginAttempts int `json:"maxLoginAttempts"`
// LockoutDuration sets the lockout duration in minutes
LockoutDuration int `json:"lockoutDuration"`
// DefaultTheme sets the default theme (light, dark, auto)
DefaultTheme string `json:"defaultTheme"`
}
Config holds the dashboard plugin configuration.
type DashboardError ¶
DashboardError represents a dashboard-specific error.
func (*DashboardError) Error ¶
func (e *DashboardError) Error() string
type DashboardErrorResponse ¶
type DashboardErrorResponse struct {
Error string `example:"Error message" json:"error"`
}
DashboardErrorResponse for dashboard routes.
type DashboardHTMLResponse ¶
type DashboardHTMLResponse struct {
HTML string `example:"<html>...</html>" json:"html"`
}
type DashboardLoginResponse ¶
type DashboardLoginResponse struct {
RedirectURL string `example:"/ui/" json:"redirect_url"`
}
type DashboardPermissions ¶
type DashboardPermissions struct {
*PermissionBuilder
}
DashboardPermissions provides dashboard-specific permission checks.
func (*DashboardPermissions) CanAccess ¶
func (d *DashboardPermissions) CanAccess() bool
CanAccess checks if user can access the dashboard.
func (*DashboardPermissions) CanManageSessions ¶
func (d *DashboardPermissions) CanManageSessions() bool
CanManageSessions checks if user can manage sessions.
func (*DashboardPermissions) CanManageUsers ¶
func (d *DashboardPermissions) CanManageUsers() bool
CanManageUsers checks if user can manage users.
func (*DashboardPermissions) CanViewAuditLogs ¶
func (d *DashboardPermissions) CanViewAuditLogs() bool
CanViewAuditLogs checks if user can view audit logs.
func (*DashboardPermissions) CanViewSessions ¶
func (d *DashboardPermissions) CanViewSessions() bool
CanViewSessions checks if user can view sessions.
func (*DashboardPermissions) CanViewUsers ¶
func (d *DashboardPermissions) CanViewUsers() bool
CanViewUsers checks if user can view users.
type DashboardPingResponse ¶
type DashboardPingResponse struct {
Message string `example:"Dashboard plugin is working!" json:"message"`
}
type DashboardStaticResponse ¶
type DashboardStats ¶
type DashboardStats struct {
TotalUsers int
ActiveUsers int
NewUsersToday int
TotalSessions int
ActiveSessions int
FailedLogins int
UserGrowth float64
SessionGrowth float64
RecentActivity []ActivityItem
SystemStatus []StatusItem
Plugins []PluginItem
}
DashboardStats represents statistics for the dashboard.
type DashboardStatusResponse ¶
type DashboardStatusResponse struct {
Status string `example:"success" json:"status"`
}
type ErrorResponse ¶
type ErrorResponse = responses.ErrorResponse
ErrorResponse types - use shared responses from core.
type ExtensionRegistry ¶
type ExtensionRegistry struct {
// contains filtered or unexported fields
}
ExtensionRegistry manages dashboard extensions from plugins.
func NewExtensionRegistry ¶
func NewExtensionRegistry() *ExtensionRegistry
NewExtensionRegistry creates a new extension registry.
func (*ExtensionRegistry) Get ¶
func (r *ExtensionRegistry) Get(id string) (ui.DashboardExtension, bool)
Get retrieves an extension by ID.
func (*ExtensionRegistry) GetAllRoutes ¶
func (r *ExtensionRegistry) GetAllRoutes() []ui.Route
GetAllRoutes returns all routes from all extensions.
func (*ExtensionRegistry) GetDashboardWidgets ¶
func (r *ExtensionRegistry) GetDashboardWidgets() []ui.DashboardWidget
GetDashboardWidgets returns all dashboard widgets sorted by order.
func (*ExtensionRegistry) GetHandler ¶
func (r *ExtensionRegistry) GetHandler() *Handler
GetHandler returns the handler instance for extensions to use Extensions can use this to access renderWithLayout and other helpers.
func (*ExtensionRegistry) GetNavigationItems ¶
func (r *ExtensionRegistry) GetNavigationItems(position ui.NavigationPosition, enabledPlugins map[string]bool) []ui.NavigationItem
GetNavigationItems returns all navigation items for a specific position.
func (*ExtensionRegistry) GetSettingsPages ¶
func (r *ExtensionRegistry) GetSettingsPages(enabledPlugins map[string]bool) []ui.SettingsPage
GetSettingsPages returns all settings pages from extensions.
func (*ExtensionRegistry) GetSettingsSections ¶
func (r *ExtensionRegistry) GetSettingsSections() []ui.SettingsSection
GetSettingsSections returns all settings sections sorted by order Deprecated: Use GetSettingsPages for the new sidebar layout.
func (*ExtensionRegistry) List ¶
func (r *ExtensionRegistry) List() []ui.DashboardExtension
List returns all registered extensions.
func (*ExtensionRegistry) Register ¶
func (r *ExtensionRegistry) Register(ext ui.DashboardExtension) error
Register registers a dashboard extension.
func (*ExtensionRegistry) RegisterBridgeFunctions ¶ added in v0.0.15
func (r *ExtensionRegistry) RegisterBridgeFunctions(ext ui.DashboardExtension, log forge.Logger) error
RegisterBridgeFunctions registers all bridge functions from an extension.
func (*ExtensionRegistry) SetBridge ¶ added in v0.0.15
func (r *ExtensionRegistry) SetBridge(b *bridge.Bridge)
SetBridge provides the bridge instance for registering extension functions.
func (*ExtensionRegistry) SetHandler ¶
func (r *ExtensionRegistry) SetHandler(h *Handler)
SetHandler sets the handler instance (called by dashboard plugin during init).
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles dashboard HTTP requests.
func NewHandler ¶
func NewHandler( assets embed.FS, appService app.Service, userSvc user.ServiceInterface, sessionSvc session.ServiceInterface, auditSvc *audit.Service, rbacSvc *rbac.Service, apikeyService *apikey.Service, orgService *organization.Service, envService environment.EnvironmentService, db *bun.DB, isMultiApp bool, basePath string, enabledPlugins map[string]bool, hookRegistry *hooks.HookRegistry, configManager forge.ConfigManager, ) *Handler
NewHandler creates a new dashboard handler.
func (*Handler) GetBasePath ¶
GetBasePath returns the dashboard base path.
func (*Handler) GetCSRFToken ¶
GetCSRFToken returns the CSRF token for the request.
func (*Handler) GetCurrentApp ¶
GetCurrentApp extracts and returns the current app from URL parameter.
func (*Handler) GetCurrentEnvironment ¶
func (h *Handler) GetCurrentEnvironment(c forge.Context, appID xid.ID) (*environment.Environment, error)
GetCurrentEnvironment returns the current environment from cookie or default.
func (*Handler) GetEnabledPlugins ¶
GetEnabledPlugins returns map of enabled plugins.
func (*Handler) GetUserApps ¶
GetUserApps returns all apps the user has access to.
func (*Handler) GetUserEnvironments ¶
func (h *Handler) GetUserEnvironments(c forge.Context, appID xid.ID) ([]*environment.Environment, error)
GetUserEnvironments returns all environments for the given app.
func (*Handler) GetUserFromContext ¶
GetUserFromContext returns the authenticated user from request context.
func (*Handler) RenderSettingsPage ¶
RenderSettingsPage renders content within the settings layout.
func (*Handler) RenderWithBaseLayout ¶ added in v0.0.3
func (h *Handler) RenderWithBaseLayout(c forge.Context, pageData components.PageData, content g.Node) error
RenderWithBaseLayout renders content with an empty layout (public for extensions).
func (*Handler) RenderWithHeaderLayout ¶ added in v0.0.3
func (h *Handler) RenderWithHeaderLayout(c forge.Context, pageData components.PageData, content g.Node) error
RenderWithHeaderLayout renders content with a header layout (public for extensions).
func (*Handler) RenderWithLayout ¶
func (h *Handler) RenderWithLayout(c forge.Context, pageData components.PageData, content g.Node) error
RenderWithLayout renders content with the dashboard layout (public for extensions) RenderWithLayout method automatically populates app, environment, and extension data.
func (*Handler) RenderWithSidebarLayout ¶ added in v0.0.3
func (h *Handler) RenderWithSidebarLayout(c forge.Context, pageData components.PageData, content g.Node) error
RenderWithSidebarLayout renders content with a sidebar layout (public for extensions).
type MessageResponse ¶
type MessageResponse = responses.MessageResponse
type Permission ¶
type Permission struct {
Action string // e.g., "view", "edit", "delete"
Resource string // e.g., "dashboard", "users", "sessions"
}
Permission represents a fine-grained permission check.
type PermissionBuilder ¶
type PermissionBuilder struct {
// contains filtered or unexported fields
}
PermissionBuilder provides a fluent API for building permission checks.
func (*PermissionBuilder) Can ¶
func (b *PermissionBuilder) Can(action, resource string) bool
Can checks a single permission.
func (*PermissionBuilder) CanCreate ¶
func (b *PermissionBuilder) CanCreate(resource string) bool
CanCreate is a shorthand for Can("create", resource).
func (*PermissionBuilder) CanDelete ¶
func (b *PermissionBuilder) CanDelete(resource string) bool
CanDelete is a shorthand for Can("delete", resource).
func (*PermissionBuilder) CanEdit ¶
func (b *PermissionBuilder) CanEdit(resource string) bool
CanEdit is a shorthand for Can("edit", resource).
func (*PermissionBuilder) CanView ¶
func (b *PermissionBuilder) CanView(resource string) bool
CanView is a shorthand for Can("view", resource).
func (*PermissionBuilder) Dashboard ¶
func (b *PermissionBuilder) Dashboard() *DashboardPermissions
Dashboard returns a dashboard-specific permission checker.
func (*PermissionBuilder) HasRole ¶
func (b *PermissionBuilder) HasRole(roleName string) bool
HasRole checks if the user has a specific role.
func (*PermissionBuilder) IsAdmin ¶
func (b *PermissionBuilder) IsAdmin() bool
IsAdmin checks if the user has the admin role.
func (*PermissionBuilder) IsOwner ¶
func (b *PermissionBuilder) IsOwner() bool
IsOwner checks if the user has the owner role.
func (*PermissionBuilder) IsSuperAdmin ¶
func (b *PermissionBuilder) IsSuperAdmin() bool
IsSuperAdmin checks if the user has the superadmin role.
type PermissionChecker ¶
type PermissionChecker struct {
// contains filtered or unexported fields
}
PermissionChecker provides a fast, expressive API for checking permissions.
func NewPermissionChecker ¶
func NewPermissionChecker(rbacSvc *rbac.Service, userRoleRepo rbac.UserRoleRepository) *PermissionChecker
NewPermissionChecker creates a new permission checker.
func (*PermissionChecker) Can ¶
Can checks if a user has permission to perform an action on a resource This is the main expressive API for permission checking.
func (*PermissionChecker) CanAll ¶
func (p *PermissionChecker) CanAll(ctx context.Context, userID xid.ID, permissions ...Permission) bool
CanAll checks if a user has all of the specified permissions.
func (*PermissionChecker) CanAny ¶
func (p *PermissionChecker) CanAny(ctx context.Context, userID xid.ID, permissions ...Permission) bool
CanAny checks if a user has any of the specified permissions.
func (*PermissionChecker) For ¶
func (p *PermissionChecker) For(ctx context.Context, userID xid.ID) *PermissionBuilder
For creates a new permission builder for a user.
func (*PermissionChecker) HasAnyRole ¶
func (p *PermissionChecker) HasAnyRole(ctx context.Context, userID xid.ID, roleNames ...string) bool
HasAnyRole checks if a user has any of the specified roles.
func (*PermissionChecker) InvalidateUserCache ¶
func (p *PermissionChecker) InvalidateUserCache(userID xid.ID)
InvalidateUserCache clears the cached roles for a user Call this when user roles are modified.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements the dashboard plugin for AuthSome.
func NewPlugin ¶
func NewPlugin(opts ...PluginOption) *Plugin
NewPlugin creates a new dashboard plugin instance with optional configuration.
func (*Plugin) AppContext ¶
AppContext middleware injects app context into dashboard requests for authless routes.
func (*Plugin) BridgeContextMiddleware ¶ added in v0.0.15
BridgeContextMiddleware enriches the HTTP request context with user, app, and environment IDs before the bridge handler processes it. This eliminates the need for each bridge function to manually extract and build context, providing a single source of truth for context enrichment.
The middleware extracts: 1. User ID from session cookie 2. App ID from session 3. Environment ID from cookie
This middleware runs BEFORE bridge function execution, so all bridge functions automatically receive an enriched context via bridgeCtx.Context().
func (*Plugin) Dependencies ¶
Dependencies declares the plugin dependencies Dependencies requires multiapp plugin for environment management.
func (*Plugin) EnvironmentContext ¶
EnvironmentContext middleware injects environment context into all dashboard requests
This middleware ensures that every app-scoped dashboard request has an environment ID set in the context. This is critical for: - Environment-scoped data operations - Multi-environment isolation - Audit trails with environment information - Dashboard extensions that need environment context
The middleware follows this flow: 1. Extract app ID from URL path parameter (:appId) 2. Check for environment ID in cookie (authsome_environment) 3. If no cookie, fetch the default environment for the app 4. Set environment context using contexts.SetEnvironmentID() 5. Update cookie for future requests (30-day expiry)
Routes without :appId parameter are skipped (e.g., /dashboard/login) Gracefully handles missing environment service for backward compatibility.
func (*Plugin) ForgeUIApp ¶ added in v0.0.15
ForgeUIApp returns the ForgeUI App instance.
func (*Plugin) ForgeUIBridge ¶ added in v0.0.15
ForgeUIBridge returns the ForgeUI Bridge instance.
func (*Plugin) PlatformOrgContext ¶
PlatformOrgContext middleware injects platform organization context into all dashboard requests PlatformOrgContext always operates in the context of the platform organization without requiring API keys.
func (*Plugin) RegisterHooks ¶
func (p *Plugin) RegisterHooks(hooks *hooks.HookRegistry) error
RegisterHooks registers hooks for the dashboard plugin.
func (*Plugin) RegisterRoles ¶
RegisterRoles implements the PluginWithRoles optional interface RegisterRoles is called automatically during server initialization to register dashboard roles.
func (*Plugin) RegisterRoutes ¶
RegisterRoutes registers the dashboard routes.
func (*Plugin) RegisterServiceDecorators ¶
func (p *Plugin) RegisterServiceDecorators(services *registry.ServiceRegistry) error
RegisterServiceDecorators registers service decorators.
func (*Plugin) RequireAdmin ¶
RequireAdmin middleware ensures the user has admin role.
type PluginItem ¶
type PluginItem struct {
ID string
Name string
Description string
Category string
Status string // enabled, disabled
Icon string // lucide icon name
}
PluginItem represents a plugin entry.
type PluginOption ¶
type PluginOption func(*Plugin)
PluginOption is a functional option for configuring the dashboard plugin.
func WithDefaultConfig ¶
func WithDefaultConfig(cfg Config) PluginOption
WithDefaultConfig sets the default configuration for the plugin.
func WithDefaultTheme ¶
func WithDefaultTheme(theme string) PluginOption
WithDefaultTheme sets the default theme.
func WithEnableSignup ¶
func WithEnableSignup(enabled bool) PluginOption
WithEnableSignup sets whether signup is enabled.
func WithLockoutDuration ¶
func WithLockoutDuration(minutes int) PluginOption
WithLockoutDuration sets the lockout duration in minutes.
func WithMaxLoginAttempts ¶
func WithMaxLoginAttempts(max int) PluginOption
WithMaxLoginAttempts sets the maximum login attempts.
func WithRequireEmailVerification ¶
func WithRequireEmailVerification(required bool) PluginOption
WithRequireEmailVerification sets whether email verification is required.
func WithSessionDuration ¶
func WithSessionDuration(hours int) PluginOption
WithSessionDuration sets the session duration in hours.
type StatusItem ¶
type StatusItem struct {
Name string
Status string // operational, degraded, down
Color string // green, yellow, red
}
StatusItem represents a system status entry.
type StatusResponse ¶
type StatusResponse = responses.StatusResponse
type SuccessResponse ¶
type SuccessResponse = responses.SuccessResponse