mirror of
https://github.com/outbackdingo/databunker.git
synced 2026-01-27 18:18:43 +00:00
save identity of last user doing operation
This commit is contained in:
@@ -103,7 +103,7 @@ func (e mainEnv) consentCancel(w http.ResponseWriter, r *http.Request, ps httpro
|
||||
if e.enforceAuth(w, r, event) == false {
|
||||
return
|
||||
}
|
||||
e.db.cancelConsentRecord(userTOKEN, brief)
|
||||
e.db.cancelConsentRecord(userTOKEN, brief, mode, address)
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(200)
|
||||
w.Write([]byte(`{"status":"ok"}`))
|
||||
|
||||
@@ -58,7 +58,7 @@ func (dbobj dbcon) createConsentRecord(userTOKEN string, mode string, usercode s
|
||||
}
|
||||
}
|
||||
|
||||
func (dbobj dbcon) cancelConsentRecord(userTOKEN string, brief string) error {
|
||||
func (dbobj dbcon) cancelConsentRecord(userTOKEN string, brief string, mode string, usercode string) error {
|
||||
// brief can not be too long, may be hash it ?
|
||||
if len(brief) > 64 {
|
||||
return errors.New("Brief value is too long")
|
||||
@@ -68,6 +68,8 @@ func (dbobj dbcon) cancelConsentRecord(userTOKEN string, brief string) error {
|
||||
// update date, status
|
||||
bdoc := bson.M{}
|
||||
bdoc["when"] = now
|
||||
bdoc["mode"] = mode
|
||||
bdoc["who"] = usercode
|
||||
bdoc["status"] = "cancel"
|
||||
dbobj.updateRecord2(TblName.Consent, "token", userTOKEN, "brief", brief, &bdoc, nil)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user