admin

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignAllowedSiteToUser added in v1.6.0

func AssignAllowedSiteToUser() gin.HandlerFunc

func AssignSiteToAdmin added in v1.6.0

func AssignSiteToAdmin() gin.HandlerFunc

func BulkAssignUsersToSite added in v1.6.0

func BulkAssignUsersToSite() gin.HandlerFunc

func BulkRemoveSitesFromUser added in v1.6.0

func BulkRemoveSitesFromUser() gin.HandlerFunc

func BulkRemoveUsersFromSite added in v1.6.0

func BulkRemoveUsersFromSite() gin.HandlerFunc

func CreateAPIKey added in v1.6.0

func CreateAPIKey() gin.HandlerFunc

CreateAPIKey generates a new long-lived token

func CreateSite

func CreateSite() gin.HandlerFunc

func CreateUser

func CreateUser() gin.HandlerFunc

func DeleteSite added in v1.4.0

func DeleteSite() gin.HandlerFunc

func DeleteUser added in v1.4.0

func DeleteUser() gin.HandlerFunc

func GetActiveSessions added in v1.6.0

func GetActiveSessions() gin.HandlerFunc

GetActiveSessions returns all active sessions (SuperAdmin only)

func GetAdminManagedSites added in v1.6.0

func GetAdminManagedSites() gin.HandlerFunc

func GetAuthProviders added in v1.6.0

func GetAuthProviders() gin.HandlerFunc

GetAuthProviders returns the list of authentication providers

func GetInfo added in v1.4.0

func GetInfo(serverInfo *app.Info) gin.HandlerFunc

GetInfo returns detailed environment information

func GetLogs added in v1.4.0

func GetLogs() gin.HandlerFunc

GetLogs reuses the existing log handling logic

func GetPermissionsCatalog added in v1.4.0

func GetPermissionsCatalog() gin.HandlerFunc

func GetSecurityPolicies added in v1.6.0

func GetSecurityPolicies() gin.HandlerFunc

GetSecurityPolicies returns current global security configuration

func GetServerConfiguration added in v1.6.0

func GetServerConfiguration() gin.HandlerFunc

GetServerConfiguration returns global server configuration for SuperAdmin

func GetSiteConfiguration added in v1.6.0

func GetSiteConfiguration() gin.HandlerFunc

GetSiteConfiguration returns technical configuration for a specific site by key.

func GetSitesConfigurations added in v1.6.0

func GetSitesConfigurations() gin.HandlerFunc

GetSitesConfigurations returns the configuration for all sites the user has access to. SuperAdmin: All sites Admin: Sites they manage (based on site_id or managed_sites claim)

func GetStats added in v1.4.0

func GetStats() gin.HandlerFunc

GetStats returns dashboard statistics

func GetUserAllowedSites added in v1.6.0

func GetUserAllowedSites() gin.HandlerFunc

func GetUserPermissions added in v1.4.0

func GetUserPermissions() gin.HandlerFunc

func ListAllAPIKeys added in v1.6.0

func ListAllAPIKeys() gin.HandlerFunc

ListAllAPIKeys returns all API keys for SuperAdmin

func ListSites

func ListSites() gin.HandlerFunc

func ListUsers

func ListUsers() gin.HandlerFunc

func RemoveAllowedSiteFromUser added in v1.6.0

func RemoveAllowedSiteFromUser() gin.HandlerFunc

func RevokeAPIKey added in v1.6.0

func RevokeAPIKey() gin.HandlerFunc

RevokeAPIKey deletes an API key

func RevokeSiteFromAdmin added in v1.6.0

func RevokeSiteFromAdmin() gin.HandlerFunc

func TerminateSession added in v1.6.0

func TerminateSession() gin.HandlerFunc

TerminateSession forces the revocation of a specific session

func UpdateAuthProvider added in v1.6.0

func UpdateAuthProvider() gin.HandlerFunc

UpdateAuthProvider updates credentials for a provider

func UpdateAuthProviderStatus added in v1.6.0

func UpdateAuthProviderStatus() gin.HandlerFunc

UpdateAuthProviderStatus toggles enabled state

func UpdateSiteStatus added in v1.4.0

func UpdateSiteStatus() gin.HandlerFunc

func UpdateUserPermissions added in v1.4.0

func UpdateUserPermissions() gin.HandlerFunc

func UpdateUserRole added in v1.4.0

func UpdateUserRole() gin.HandlerFunc

func UpdateUserStatus added in v1.4.0

func UpdateUserStatus() gin.HandlerFunc

Types

type AdminUserDTO added in v1.4.0

type AdminUserDTO struct {
	ID         string     `json:"id"`
	SiteID     *string    `json:"site_id"`
	SiteKey    *string    `json:"site_key"`
	Username   string     `json:"username"`
	Role       string     `json:"role"`
	Status     string     `json:"status"`
	IsGlobal   bool       `json:"is_global"`
	IsExternal bool       `json:"is_external"`
	CreatedAt  *time.Time `json:"created_at"`
	UpdatedAt  *time.Time `json:"updated_at"`
}

AdminUserDTO represents user information for administration

func MapAdminUserToDTO added in v1.4.0

func MapAdminUserToDTO(u database.User) AdminUserDTO

MapAdminUserToDTO converts a User entity to AdminUserDTO

type ApiKeyDTO added in v1.6.0

type ApiKeyDTO struct {
	ID         string     `json:"id"`
	UserID     string     `json:"user_id"`
	Username   string     `json:"username,omitempty"`
	Name       string     `json:"name"`
	Scopes     []string   `json:"scopes"`
	ExpiresAt  *time.Time `json:"expires_at"`
	LastUsedAt *time.Time `json:"last_used_at"`
	CreatedAt  *time.Time `json:"created_at"`
}

ApiKeyDTO represents an API Key for administration

func MapApiKeyToDTO added in v1.6.0

func MapApiKeyToDTO(ak database.APIKey) ApiKeyDTO

MapApiKeyToDTO converts a database.APIKey to ApiKeyDTO

type AssignSiteRequest added in v1.6.0

type AssignSiteRequest struct {
	SiteKey string `json:"site_key" binding:"required"`
}

type AuthProviderDTO added in v1.6.0

type AuthProviderDTO struct {
	Slug        string    `json:"slug"`
	Name        string    `json:"name"`
	Enabled     bool      `json:"enabled"`
	ClientID    string    `json:"client_id"`
	RedirectURL string    `json:"redirect_url"`
	TenantID    string    `json:"tenant_id,omitempty"`
	UpdatedAt   time.Time `json:"updated_at"`
}

AuthProviderDTO represents an external authentication provider

func MapAuthProviderToDTO added in v1.6.0

func MapAuthProviderToDTO(p database.AuthProvider) AuthProviderDTO

MapAuthProviderToDTO converts a database.AuthProvider to AuthProviderDTO

type BulkAssignUsersRequest added in v1.6.0

type BulkAssignUsersRequest struct {
	Usernames []string `json:"usernames" binding:"required"`
}

type CreateSiteRequest

type CreateSiteRequest struct {
	Key  string `json:"key" binding:"required"`
	Host string `json:"host" binding:"required"`
}

type CreateUserRequest

type CreateUserRequest struct {
	SiteKey    string `json:"site_key"`
	Username   string `json:"username" binding:"required"`
	Password   string `json:"password"`
	Role       string `json:"role"`
	IsGlobal   *bool  `json:"is_global"`
	IsExternal *bool  `json:"is_external"`
}

type SecurityPolicyDTO added in v1.6.0

type SecurityPolicyDTO struct {
	MainDomain            string   `json:"main_domain"`
	ContentSecurityPolicy string   `json:"content_security_policy"`
	PermissionsPolicy     string   `json:"permissions_policy"`
	RateLimitRequests     int      `json:"rate_limit_requests"`
	GlobalWhitelist       []string `json:"global_whitelist"`
	CookieSettings        gin.H    `json:"cookie_settings"`
}

SecurityPolicyDTO represents global security policies

type ServerConfigDTO added in v1.6.0

type ServerConfigDTO struct {
	MainDomain                 string   `json:"main_domain"`
	Port                       int      `json:"port"`
	DevMode                    bool     `json:"dev_mode"`
	TokenExpirationTime        int      `json:"token_expiration_time"`
	TokenExpirationRefreshTime int      `json:"token_expiration_refresh_time"`
	RateLimitRequests          int      `json:"rate_limit_requests"`
	CookieSameSite             string   `json:"cookie_same_site"`
	CookieHttpOnly             bool     `json:"cookie_http_only"`
	CookieSecure               bool     `json:"cookie_secure"`
	CookieDomain               string   `json:"cookie_domain"`
	GlobalWhitelist            []string `json:"global_whitelist"`
	LogLevel                   string   `json:"log_level"`
	LogPath                    string   `json:"log_path"`
	DatabaseHost               string   `json:"database_host"`
	DatabasePort               int      `json:"database_port"`
	DatabaseName               string   `json:"database_name"`
	DatabaseSchema             string   `json:"database_schema"`
}

ServerConfigDTO represents global server configuration for SuperAdmin

func MapServerConfigToDTO added in v1.6.0

func MapServerConfigToDTO(c *loaders.Config) ServerConfigDTO

MapServerConfigToDTO converts loaders.Config to ServerConfigDTO

type SessionDTO added in v1.6.0

type SessionDTO struct {
	ID        int64      `json:"id"`
	UserID    string     `json:"user_id"`
	Username  string     `json:"username,omitempty"`
	IPAddress string     `json:"ip_address,omitempty"`
	UserAgent string     `json:"user_agent,omitempty"`
	IssuedAt  *time.Time `json:"issued_at"`
	ExpiresAt *time.Time `json:"expires_at"`
}

SessionDTO represents an active session

func MapSessionToDTO added in v1.6.0

func MapSessionToDTO(s database.AuthSession) SessionDTO

MapSessionToDTO converts a database.AuthSession to SessionDTO

type SiteConfigDTO added in v1.6.0

type SiteConfigDTO struct {
	Enabled               bool     `json:"enabled"`
	Directory             string   `json:"directory"`
	Domains               []string `json:"domains"`
	Proxy                 bool     `json:"proxy"`
	ProxyTarget           string   `json:"proxy_target"`
	AllowOrigin           []string `json:"allow_origin"`
	ContentSecurityPolicy string   `json:"content_security_policy"`
	AutoJWT               bool     `json:"auto_jwt"`
	SMTPHost              string   `json:"smtp_host"`
	SMTPPort              int      `json:"smtp_port"`
}

SiteConfigDTO represents detailed site configuration for administration

func MapSiteConfigToDTO added in v1.6.0

func MapSiteConfigToDTO(s loaders.SiteConfig) SiteConfigDTO

MapSiteConfigToDTO converts a loaders.SiteConfig to SiteConfigDTO

type SiteDTO added in v1.4.0

type SiteDTO struct {
	ID        string    `json:"id"`
	Key       string    `json:"key"`
	Host      string    `json:"host"`
	Status    string    `json:"status"`
	CreatedAt time.Time `json:"created_at"`
}

SiteDTO represents site information for administration

func MapSiteToDTO added in v1.4.0

func MapSiteToDTO(s database.Site) SiteDTO

MapSiteToDTO converts a Site entity to SiteDTO

type UpdatePermissionsRequest added in v1.4.0

type UpdatePermissionsRequest struct {
	Permissions UserPermissions `json:"permissions" binding:"required"`
}

type UpdateSiteStatusRequest added in v1.4.0

type UpdateSiteStatusRequest struct {
	Status string `json:"status" binding:"required"`
}

type UserPermissions added in v1.4.0

type UserPermissions struct {
	Grants []string `json:"grants"`
	Denies []string `json:"denies"`
}

Jump to

Keyboard shortcuts

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