Convert db backend to use Gorm, with basis for support

for Mysql and Postgres in addition to existing Sqlite
This commit is contained in:
Jamie Curnow committed 2023-05-26 11:37:39 +10:00
1 parent b4e5b8b6db
commit 29990110b1
93 files changed
+1215 -3075

No files matched your search

+1 -1
View File
@@ -48,7 +48,7 @@ func Enforce(permission string) func(http.Handler) http.Handler {
return
}
userID := int(claims["uid"].(float64))
userID := uint(claims["uid"].(float64))
_, enabled := user.IsEnabled(userID)
if token == nil || !token.Valid || !enabled {
h.ResultErrorJSON(w, r, http.StatusUnauthorized, "Unauthorised", nil)
+1 -1
View File
@@ -21,7 +21,7 @@ func SSEAuth(next http.Handler) http.Handler {
return
}
userID := int(claims["uid"].(float64))
userID := uint(claims["uid"].(float64))
_, enabled := user.IsEnabled(userID)
if token == nil || !token.Valid || !enabled || !claims.VerifyIssuer("sse", true) {
h.ResultErrorJSON(w, r, http.StatusUnauthorized, "Unauthorised", nil)