[PR #2874] [MERGED] [management] Refactor posture check to use store methods #20732

Closed
opened 2026-08-05 05:07:38 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/2874
Author: @bcmmbaga
Created: 11/11/2024
Status: Merged
Merged: 11/25/2024
Merged by: @pascal-fischer

Base: mainHead: posturechecks-get-account-refactoring


📝 Commits (10+)

  • 389c961 Refactor setup key handling to use store methods
  • 78044c2 add lock to get account groups
  • 1a5f3c6 add check for regular user
  • 931521d get only required groups for auto-group validation
  • f8b5eed add account lock and return auto groups map on validation
  • 106fc75 refactor account peers update
  • 0a70e4c Refactor groups to use store methods
  • 8126d95 refactor GetGroupByID and add NewGroupNotFoundError
  • ac05f69 fix tests
  • 40af1a5 Merge branch 'feature/get-account-refactoring' into setupkey-get-account-refactoring

📊 Changes

18 files changed (+563 additions, -234 deletions)

View changed files

📝 management/server/account.go (+1 -1)
📝 management/server/dns.go (+1 -1)
📝 management/server/group.go (+17 -2)
📝 management/server/http/posture_checks_handler.go (+2 -1)
📝 management/server/http/posture_checks_handler_test.go (+3 -3)
📝 management/server/mock_server/account_mock.go (+3 -3)
📝 management/server/nameserver.go (+5 -5)
📝 management/server/peer.go (+21 -4)
📝 management/server/policy.go (+3 -3)
📝 management/server/posture/checks.go (+0 -6)
📝 management/server/posture_checks.go (+179 -116)
📝 management/server/posture_checks_test.go (+131 -80)
📝 management/server/route.go (+5 -5)
📝 management/server/sql_store.go (+48 -3)
📝 management/server/sql_store_test.go (+135 -0)
📝 management/server/status/error.go (+5 -0)
📝 management/server/store.go (+3 -1)
📝 management/server/testdata/extended-store.sql (+1 -0)

📄 Description

Describe your changes

Remove calls to get and save whole account in posture check operations.

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 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/2874 **Author:** [@bcmmbaga](https://github.com/bcmmbaga) **Created:** 11/11/2024 **Status:** ✅ Merged **Merged:** 11/25/2024 **Merged by:** [@pascal-fischer](https://github.com/pascal-fischer) **Base:** `main` ← **Head:** `posturechecks-get-account-refactoring` --- ### 📝 Commits (10+) - [`389c961`](https://github.com/netbirdio/netbird/commit/389c9619afe8b6d129a12d137bf332491503bb83) Refactor setup key handling to use store methods - [`78044c2`](https://github.com/netbirdio/netbird/commit/78044c226d9240edcdd5bb180aaab1da86f442e4) add lock to get account groups - [`1a5f3c6`](https://github.com/netbirdio/netbird/commit/1a5f3c653c4b78a5c52bca9bba74c966fbd7495c) add check for regular user - [`931521d`](https://github.com/netbirdio/netbird/commit/931521d505b012f45dcf5bcb5de0ee07f0c5b876) get only required groups for auto-group validation - [`f8b5eed`](https://github.com/netbirdio/netbird/commit/f8b5eedd382d8a218517cf7c7b552f3a0dd8ee3d) add account lock and return auto groups map on validation - [`106fc75`](https://github.com/netbirdio/netbird/commit/106fc759365d535db529d93c9c1ad0324b2ccff6) refactor account peers update - [`0a70e4c`](https://github.com/netbirdio/netbird/commit/0a70e4c5d45292223c78427984fb470aaf0a9a40) Refactor groups to use store methods - [`8126d95`](https://github.com/netbirdio/netbird/commit/8126d953166ddfa79950469f42d0a8dc5084ce71) refactor GetGroupByID and add NewGroupNotFoundError - [`ac05f69`](https://github.com/netbirdio/netbird/commit/ac05f69131651fded5f6a304b7dbe2b517a72b31) fix tests - [`40af1a5`](https://github.com/netbirdio/netbird/commit/40af1a50e3e94732c1524f2330b688473d4b6212) Merge branch 'feature/get-account-refactoring' into setupkey-get-account-refactoring ### 📊 Changes **18 files changed** (+563 additions, -234 deletions) <details> <summary>View changed files</summary> 📝 `management/server/account.go` (+1 -1) 📝 `management/server/dns.go` (+1 -1) 📝 `management/server/group.go` (+17 -2) 📝 `management/server/http/posture_checks_handler.go` (+2 -1) 📝 `management/server/http/posture_checks_handler_test.go` (+3 -3) 📝 `management/server/mock_server/account_mock.go` (+3 -3) 📝 `management/server/nameserver.go` (+5 -5) 📝 `management/server/peer.go` (+21 -4) 📝 `management/server/policy.go` (+3 -3) 📝 `management/server/posture/checks.go` (+0 -6) 📝 `management/server/posture_checks.go` (+179 -116) 📝 `management/server/posture_checks_test.go` (+131 -80) 📝 `management/server/route.go` (+5 -5) 📝 `management/server/sql_store.go` (+48 -3) 📝 `management/server/sql_store_test.go` (+135 -0) 📝 `management/server/status/error.go` (+5 -0) 📝 `management/server/store.go` (+3 -1) 📝 `management/server/testdata/extended-store.sql` (+1 -0) </details> ### 📄 Description ## Describe your changes Remove calls to get and save whole account in posture check operations. ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [x] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <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 05:07:38 -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#20732