mirror of
https://github.com/documize/community.git
synced 2025-07-23 07:09:43 +02:00
event logging
This commit is contained in:
parent
b6c676149a
commit
93ed361705
48 changed files with 861 additions and 853 deletions
|
@ -163,6 +163,16 @@ func AddUser(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
if addUser {
|
||||
event.Handler().Publish(string(event.TypeAddUser))
|
||||
p.RecordEvent(entity.EventTypeUserAdd)
|
||||
}
|
||||
|
||||
if addAccount {
|
||||
event.Handler().Publish(string(event.TypeAddAccount))
|
||||
p.RecordEvent(entity.EventTypeAccountAdd)
|
||||
}
|
||||
|
||||
log.IfErr(tx.Commit())
|
||||
|
||||
// If we did not add user or give them access (account) then we error back
|
||||
|
@ -175,14 +185,6 @@ func AddUser(w http.ResponseWriter, r *http.Request) {
|
|||
inviter, err := p.GetUser(p.Context.UserID)
|
||||
log.IfErr(err)
|
||||
|
||||
if addUser {
|
||||
event.Handler().Publish(string(event.TypeAddUser))
|
||||
}
|
||||
|
||||
if addAccount {
|
||||
event.Handler().Publish(string(event.TypeAddAccount))
|
||||
}
|
||||
|
||||
// Prepare invitation email (that contains SSO link)
|
||||
if addUser && addAccount {
|
||||
size := len(requestedPassword)
|
||||
|
@ -393,6 +395,8 @@ func DeleteUser(w http.ResponseWriter, r *http.Request) {
|
|||
err = p.ChangeLabelOwner(userID, p.Context.UserID)
|
||||
log.IfErr(err)
|
||||
|
||||
p.RecordEvent(entity.EventTypeUserDelete)
|
||||
|
||||
log.IfErr(tx.Commit())
|
||||
|
||||
event.Handler().Publish(string(event.TypeRemoveUser))
|
||||
|
@ -485,6 +489,8 @@ func UpdateUser(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
p.RecordEvent(entity.EventTypeUserUpdate)
|
||||
|
||||
log.IfErr(tx.Commit())
|
||||
|
||||
json, err := json.Marshal(user)
|
||||
|
@ -701,6 +707,8 @@ func ResetUserPassword(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
p.RecordEvent(entity.EventTypeUserPasswordReset)
|
||||
|
||||
log.IfErr(tx.Commit())
|
||||
|
||||
_, err = w.Write([]byte("{}"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue