Go-Backend (chi, pgx, golang-migrate) + React/TS-Frontend als PWA. Enthalten: Auth inkl. OIDC, Dateien mit Versionen und Papierkorb, Freigaben (Links + intern), WebDAV, Gruppenordner, Admin/Theming, Volltextsuche mit OCR, eigener PDF-Betrachter und WOPI-Office (Collabora/OnlyOffice). Nicht im Repo: deploy/.env (Sitzungsschlüssel, DB- und Admin-Passwort) sowie alle Daten- und Build-Verzeichnisse – siehe .gitignore. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
38 lines
1.3 KiB
Go
38 lines
1.3 KiB
Go
package auth
|
||
|
||
import (
|
||
"context"
|
||
"time"
|
||
|
||
"github.com/google/uuid"
|
||
)
|
||
|
||
type User struct {
|
||
ID uuid.UUID `json:"id"`
|
||
Username string `json:"username"`
|
||
DisplayName string `json:"display_name"`
|
||
IsAdmin bool `json:"is_admin"`
|
||
QuotaBytes int64 `json:"quota_bytes"`
|
||
UsedBytes int64 `json:"used_bytes"`
|
||
// Persönliche Palette. Sie bleibt gespeichert, auch wenn UseCustomTheme
|
||
// aus ist – so kann man jederzeit umschalten, ohne sie neu zu wählen.
|
||
PrimaryColor string `json:"primary_color"`
|
||
AccentColor string `json:"accent_color"`
|
||
UseCustomTheme bool `json:"use_custom_theme"`
|
||
// IsOIDC heißt: Dieses Konto meldet sich über den Identitätsanbieter an
|
||
// und hat hier gar kein Passwort (`password` steht auf ''). Die Oberfläche
|
||
// blendet die Passwortänderung dann aus – ein Formular, das nur
|
||
// fehlschlagen kann, ist schlimmer als keines.
|
||
//
|
||
// Nicht sicherheitsrelevant, sondern eine Auskunft: Anmeldung und
|
||
// Passwortänderung scheitern für solche Konten ohnehin schon daran, dass
|
||
// '' kein gültiger Argon2-Hash ist.
|
||
IsOIDC bool `json:"is_oidc"`
|
||
CreatedAt time.Time `json:"created_at"`
|
||
}
|
||
|
||
// UsageQuerier is satisfied by files.Store – keeps auth ↔ files decoupled.
|
||
type UsageQuerier interface {
|
||
UsedBytes(ctx context.Context, userID uuid.UUID) (int64, error)
|
||
}
|