1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-18 20:59:43 +02:00

Record user event backed-up-database

This commit is contained in:
Harvey Kandola 2018-10-20 17:31:59 +01:00
parent 88b84dc5ed
commit 9667e8c2a0
3 changed files with 671 additions and 666 deletions

View file

@ -36,6 +36,7 @@ import (
"encoding/json"
"fmt"
"github.com/documize/community/core/request"
"github.com/documize/community/model/audit"
"io"
"io/ioutil"
"net/http"
@ -128,13 +129,15 @@ func (h *Handler) Backup(w http.ResponseWriter, r *http.Request) {
return
}
w.WriteHeader(http.StatusOK)
h.Runtime.Log.Info(fmt.Sprintf("Backup completed for %s by %s, size %d", ctx.OrgID, ctx.UserID, x))
h.Store.Audit.Record(ctx, audit.EventTypeDatabaseBackup)
// Delete backup file if not requested to keep it.
if !spec.Retain {
os.Remove(filename)
}
w.WriteHeader(http.StatusOK)
}
// Restore receives ZIP file for restore operation.

File diff suppressed because one or more lines are too long

View file

@ -9,7 +9,7 @@
//
// https://documize.com
// Package eventing records and propagates events based on user actions.
// Package audit records and propagates events based on user actions.
package audit
import "time"
@ -93,6 +93,8 @@ const (
EventTypeWorkflowApprovedChange EventType = "approved-change"
EventTypeWorkflowRejectedChange EventType = "rejected-change"
EventTypeWorkflowPublishRequested EventType = "requested-publication"
EventTypeDatabaseBackup EventType = "backedup-database"
EventTypeDatabaseRestore EventType = "restored-database"
// EventTypeVersionAdd records addition of version
EventTypeVersionAdd EventType = "added-version"