feat: add admin apis
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user