Skip to content

Commit

Permalink
Track user block/unblock activity event (netbirdio#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
braginini authored May 17, 2023
1 parent db69a0c commit 6e9f753
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions management/server/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,14 @@ func (am *DefaultAccountManager) SaveUser(accountID, initiatorUserID string, upd
}

defer func() {
if oldUser.IsBlocked() != update.IsBlocked() {
if update.IsBlocked() {
am.storeEvent(initiatorUserID, oldUser.Id, accountID, activity.UserBlocked, nil)
} else {
am.storeEvent(initiatorUserID, oldUser.Id, accountID, activity.UserUnblocked, nil)
}
}

// store activity logs
if oldUser.Role != newUser.Role {
am.storeEvent(initiatorUserID, oldUser.Id, accountID, activity.UserRoleUpdated, map[string]any{"role": newUser.Role})
Expand Down

0 comments on commit 6e9f753

Please sign in to comment.