feat: add admin apis

This commit is contained in:
Krispire Admin
2026-06-16 14:47:45 +05:30
parent aa61f4f0b1
commit a49bf7591e
24 changed files with 1164 additions and 22 deletions
+6
View File
@@ -53,6 +53,12 @@ func RequireAuth(issuer *auth.Issuer, users *repository.UserRepo) func(http.Hand
response.Error(w, http.StatusUnauthorized, "session expired — please log in again")
return
}
// Suspended accounts are locked out of every protected route, so a
// ban takes effect immediately for active sessions too.
if u.BannedAt != nil {
response.Error(w, http.StatusForbidden, "this account has been suspended")
return
}
ctx := context.WithValue(r.Context(), userIDKey, claims.UserID)
ctx = context.WithValue(ctx, tokenVersionKey, claims.TokenVersion)