mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-17 15:56:39 +00:00
Add join user operation
This commit is contained in:
@@ -752,6 +752,20 @@ func (am *DefaultAccountManager) handleNewUserAccount(domainAcc *Account, claims
|
||||
return nil, err
|
||||
}
|
||||
|
||||
opEvent := event.Event{
|
||||
Timestamp: time.Now(),
|
||||
Type: event.ManagementEvent,
|
||||
OperationCode: event.UserJoinedOperation,
|
||||
AccountID: account.Id,
|
||||
TargetID: claims.UserId,
|
||||
ModifierID: claims.UserId,
|
||||
}
|
||||
|
||||
_, err = am.eventStore.Save(opEvent)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return account, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -12,13 +12,29 @@ const (
|
||||
const (
|
||||
AddPeerByUserOperation Operation = iota
|
||||
AddPeerWithKeyOperation
|
||||
UserJoinedOperation
|
||||
)
|
||||
|
||||
const (
|
||||
AddPeerByUserOperationMessage string = "Add new peer"
|
||||
AddPeerWithKeyOperationMessage string = AddPeerByUserOperationMessage
|
||||
UserJoinedOperationMessage string = "New user joined"
|
||||
)
|
||||
|
||||
// MessageForOperation returns a string message for an Operation
|
||||
func MessageForOperation(op Operation) string {
|
||||
switch op {
|
||||
case AddPeerByUserOperation:
|
||||
return AddPeerByUserOperationMessage
|
||||
case AddPeerWithKeyOperation:
|
||||
return AddPeerWithKeyOperationMessage
|
||||
case UserJoinedOperation:
|
||||
return UserJoinedOperationMessage
|
||||
default:
|
||||
return "UNKNOWN_OPERATION"
|
||||
}
|
||||
}
|
||||
|
||||
// Type of the Event
|
||||
type Type string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user