Skip user check for system initiated peer deletion

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
bcmmbaga
2025-01-16 20:52:41 +03:00
parent aeb6e53e51
commit 30ae3aa030

View File

@@ -335,13 +335,15 @@ func (am *DefaultAccountManager) DeletePeer(ctx context.Context, accountID, peer
unlock := am.Store.AcquireWriteLockByUID(ctx, accountID) unlock := am.Store.AcquireWriteLockByUID(ctx, accountID)
defer unlock() defer unlock()
user, err := am.Store.GetUserByUserID(ctx, store.LockingStrengthShare, userID) if userID != activity.SystemInitiator {
if err != nil { user, err := am.Store.GetUserByUserID(ctx, store.LockingStrengthShare, userID)
return err if err != nil {
} return err
}
if user.AccountID != accountID { if user.AccountID != accountID {
return status.NewUserNotPartOfAccountError() return status.NewUserNotPartOfAccountError()
}
} }
peerAccountID, err := am.Store.GetAccountIDByPeerID(ctx, store.LockingStrengthShare, peerID) peerAccountID, err := am.Store.GetAccountIDByPeerID(ctx, store.LockingStrengthShare, peerID)