[PR #6733] [management] preserve stored state for absent IdP users #29841

Open
opened 2026-08-05 08:09:07 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6733
Author: @CoderSufiyan
Created: 7/12/2026
Status: 🔄 Open

Base: mainHead: fix/issue-6651-preserve-absent-idp-state


📝 Commits (3)

  • 573f989 [management] preserve stored state for absent IdP users
  • 32cbdc3 [management] preserve non-deletable user info state
  • 15f0aef [management] keep blocked status in user info fallback

📊 Changes

3 files changed (+58 additions, -23 deletions)

View changed files

📝 management/server/types/user.go (+7 -1)
📝 management/server/user.go (+3 -14)
📝 management/server/user_test.go (+48 -8)

📄 Description

Description

When the external IdP omits a stored user, the fallback path should preserve that user's stored state instead of rebuilding a partial active record.

This change reuses ToUserInfo(nil) so absent users keep their stored name, email, and blocked flag.

Changes

  • reuse the local fallback for users missing from external IdP results
  • add a regression test for a blocked stored user omitted from IdP data
  • keep the test isolated from live IdP loading with a controlled cache loader

Testing

  • go test ./management/server -run ^TestDefaultAccountManager_ExternalCache$ -count=1
  • go build ./management/...
  • go vet ./management/server

Fixes #6651

Summary by CodeRabbit

  • Bug Fixes
    • Improved generation of account user info when a user is missing from the identity provider, using the local profile as the source of truth.
    • Preserved blocked/disabled state along with the user’s name and email.
    • Ensured service users correctly reflect Non-deletable status, with more reliable handling when user info can’t be generated.
  • Tests
    • Updated cache-related account user tests to validate persisted absent users and corresponding user info fields.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/6733 **Author:** [@CoderSufiyan](https://github.com/CoderSufiyan) **Created:** 7/12/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/issue-6651-preserve-absent-idp-state` --- ### 📝 Commits (3) - [`573f989`](https://github.com/netbirdio/netbird/commit/573f989c3a3cb4fb4de06331189699d4df081f7e) [management] preserve stored state for absent IdP users - [`32cbdc3`](https://github.com/netbirdio/netbird/commit/32cbdc3c2dbee57b3295367f470f2281445ab0a4) [management] preserve non-deletable user info state - [`15f0aef`](https://github.com/netbirdio/netbird/commit/15f0aef31243e4a4068ed0a7401da999fd76953a) [management] keep blocked status in user info fallback ### 📊 Changes **3 files changed** (+58 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `management/server/types/user.go` (+7 -1) 📝 `management/server/user.go` (+3 -14) 📝 `management/server/user_test.go` (+48 -8) </details> ### 📄 Description ## Description When the external IdP omits a stored user, the fallback path should preserve that user's stored state instead of rebuilding a partial active record. This change reuses `ToUserInfo(nil)` so absent users keep their stored name, email, and blocked flag. ## Changes - reuse the local fallback for users missing from external IdP results - add a regression test for a blocked stored user omitted from IdP data - keep the test isolated from live IdP loading with a controlled cache loader ## Testing - `go test ./management/server -run ^TestDefaultAccountManager_ExternalCache$ -count=1` - `go build ./management/...` - `go vet ./management/server` Fixes #6651 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved generation of account user info when a user is missing from the identity provider, using the local profile as the source of truth. * Preserved blocked/disabled state along with the user’s name and email. * Ensured service users correctly reflect **Non-deletable** status, with more reliable handling when user info can’t be generated. * **Tests** * Updated cache-related account user tests to validate persisted absent users and corresponding user info fields. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 08:09:07 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#29841