mirror of
https://github.com/documize/community.git
synced 2025-07-19 05:09:42 +02:00
Record user event backed-up-database
This commit is contained in:
parent
88b84dc5ed
commit
9667e8c2a0
3 changed files with 671 additions and 666 deletions
|
@ -36,6 +36,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/documize/community/core/request"
|
"github.com/documize/community/core/request"
|
||||||
|
"github.com/documize/community/model/audit"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -128,13 +129,15 @@ func (h *Handler) Backup(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
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.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.
|
// Delete backup file if not requested to keep it.
|
||||||
if !spec.Retain {
|
if !spec.Retain {
|
||||||
os.Remove(filename)
|
os.Remove(filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore receives ZIP file for restore operation.
|
// Restore receives ZIP file for restore operation.
|
||||||
|
|
1328
embed/bindata.go
1328
embed/bindata.go
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@
|
||||||
//
|
//
|
||||||
// https://documize.com
|
// 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
|
package audit
|
||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
@ -93,6 +93,8 @@ const (
|
||||||
EventTypeWorkflowApprovedChange EventType = "approved-change"
|
EventTypeWorkflowApprovedChange EventType = "approved-change"
|
||||||
EventTypeWorkflowRejectedChange EventType = "rejected-change"
|
EventTypeWorkflowRejectedChange EventType = "rejected-change"
|
||||||
EventTypeWorkflowPublishRequested EventType = "requested-publication"
|
EventTypeWorkflowPublishRequested EventType = "requested-publication"
|
||||||
|
EventTypeDatabaseBackup EventType = "backedup-database"
|
||||||
|
EventTypeDatabaseRestore EventType = "restored-database"
|
||||||
|
|
||||||
// EventTypeVersionAdd records addition of version
|
// EventTypeVersionAdd records addition of version
|
||||||
EventTypeVersionAdd EventType = "added-version"
|
EventTypeVersionAdd EventType = "added-version"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue