-
-
Notifications
You must be signed in to change notification settings - Fork 1k
[management] permission manager validate account access #3444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
80cae4e to
17849b2
Compare
202df67 to
f8cf9d5
Compare
|
@pnmcosta can you handle sonar findings? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the account management code to integrate a centralized permissions manager and adds new functionality to create and update accounts by private domain.
- Introduces two new methods: CreateAccountByPrivateDomain and UpdateToPrimaryAccount.
- Replaces direct account ID checks with calls to permissionsManager.ValidateAccountAccess in various methods.
- Updates BuildManager signature, tests, and mocks throughout the codebase to support the new permissions manager.
Reviewed Changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| management/server/account.go | Added new account creation/update methods and replaced direct checks with permissions validation. |
| management/server/event.go | Updated event handling to populate user info with permissions considerations. |
| management/server/account_test.go | Added tests for new methods and updated BuildManager usage to pass permissions manager. |
| management/server/peer.go | Replaced direct account checks with calls to permissionsManager.ValidateAccountAccess. |
| management/server/mock_server/account_mock.go | Added mocks for the new methods. |
| management/server/dns*.go, nameserver*.go, group.go | Replaced direct user.AccountID comparisons with permissions validation calls. |
| client/internal/engine_test.go, client/cmd/testutil_test.go, etc. | Updated tests to include the new permissions manager dependency. |
| management/cmd/management.go | Updated BuildManager call to initialize the permissions manager via integrations. |
| management/server/http/handlers/events/events_handler.go | Removed unused legacy event metadata filling code. |
Comments suppressed due to low confidence (2)
management/server/account.go:1714
- [nitpick] Consider replacing the magic number '2' with a named constant (e.g., retryCount) to improve clarity and maintainability.
for range 2 {
management/server/account.go:1110
- The direct check 'user.AccountID != accountID' has been replaced with permissionsManager.ValidateAccountAccess; ensure that the new validation call handles all the required permission scenarios consistently.
if user.AccountID != accountID {
3766f0e to
61b0acd
Compare
61b0acd to
865d89a
Compare
# Conflicts: # go.mod # go.sum
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
* refactor routes permissions Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com> * fix tests --------- Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com> Co-authored-by: Pascal Fischer <pascal@netbird.io>
# Conflicts: # client/server/server_test.go # go.mod # go.sum
|



Describe your changes
Issue ticket number and link
Checklist