[PR #5482] [CLOSED] [management] Move permissions management from managers to API handlers #25969

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5482
Author: @pascal-fischer
Created: 3/2/2026
Status: Closed

Base: mainHead: refactor/permissions-manager


📝 Commits (10+)

  • 32730af use api wrapper for permissions management
  • b0ce004 Merge branch 'refs/heads/main' into refactor/permissions-manager
  • da4a0eb Merge branch 'main' into refactor/permissions-manager
  • d85ee0b remove old permissions management
  • 3741eb4 Merge remote-tracking branch 'origin/main' into refactor/permissions-manager
  • 3013c98 Merge branch 'main' into refactor/permissions-manager
  • beee14b fix merge conflicts
  • f5c8a6f update integrations
  • 20e6dff Merge branch 'main' into refactor/permissions-manager
  • 31d901c update role permissions for admins

📊 Changes

145 files changed (+4181 additions, -3658 deletions)

View changed files

📝 client/cmd/testutil_test.go (+3 -2)
📝 client/internal/engine_test.go (+2 -2)
📝 client/server/server_test.go (+3 -2)
📝 go.mod (+1 -1)
📝 go.sum (+2 -2)
📝 management/internals/modules/peers/manager.go (+2 -25)
📝 management/internals/modules/permissions/manager.go (+71 -7)
📝 management/internals/modules/permissions/manager_mock.go (+31 -9)
📝 management/internals/modules/permissions/modules/module.go (+0 -0)
📝 management/internals/modules/permissions/operations/operation.go (+0 -0)
📝 management/internals/modules/permissions/roles/admin.go (+3 -3)
📝 management/internals/modules/permissions/roles/auditor.go (+1 -1)
📝 management/internals/modules/permissions/roles/network_admin.go (+2 -2)
📝 management/internals/modules/permissions/roles/owner.go (+1 -1)
📝 management/internals/modules/permissions/roles/role_permissions.go (+2 -2)
📝 management/internals/modules/permissions/roles/user.go (+1 -1)
📝 management/internals/modules/reverseproxy/accesslogs/manager/api.go (+7 -10)
📝 management/internals/modules/reverseproxy/accesslogs/manager/manager.go (+6 -20)
📝 management/internals/modules/reverseproxy/domain/manager/api.go (+13 -34)
📝 management/internals/modules/reverseproxy/domain/manager/manager.go (+9 -54)

...and 80 more files

📄 Description

Describe your changes

Stack

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)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • Refactor

    • Permission checks centralized into HTTP middleware; backend modules no longer perform inline permission gating and manager wiring simplified.
  • Behavior

    • Handlers now receive resolved user authentication consistently, yielding uniform access control behavior across endpoints.
  • Tests

    • Added integration tests and test fixtures; unit/integration tests updated to exercise the centralized permission wrapper and expanded account scenarios.

🔄 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/5482 **Author:** [@pascal-fischer](https://github.com/pascal-fischer) **Created:** 3/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `refactor/permissions-manager` --- ### 📝 Commits (10+) - [`32730af`](https://github.com/netbirdio/netbird/commit/32730af33f448474812aaaef0fb06dd72d348c19) use api wrapper for permissions management - [`b0ce004`](https://github.com/netbirdio/netbird/commit/b0ce0048b4c4f2f298e7ba5acfff96bbdee7faaf) Merge branch 'refs/heads/main' into refactor/permissions-manager - [`da4a0eb`](https://github.com/netbirdio/netbird/commit/da4a0eb68a8cdc84a9ce2e798f41de8f44cabde9) Merge branch 'main' into refactor/permissions-manager - [`d85ee0b`](https://github.com/netbirdio/netbird/commit/d85ee0b5a28d7bf8ec57be4a452861ac51414bc1) remove old permissions management - [`3741eb4`](https://github.com/netbirdio/netbird/commit/3741eb46ddb4e067301e612a2a6dd1dcbf0f344a) Merge remote-tracking branch 'origin/main' into refactor/permissions-manager - [`3013c98`](https://github.com/netbirdio/netbird/commit/3013c98ab56a538e7c04616b918174571df6e7b4) Merge branch 'main' into refactor/permissions-manager - [`beee14b`](https://github.com/netbirdio/netbird/commit/beee14b9bfe50add3d53cd9beeff5e82b46052f1) fix merge conflicts - [`f5c8a6f`](https://github.com/netbirdio/netbird/commit/f5c8a6fe1aa74eba11ea5c0905b60fe900cb5904) update integrations - [`20e6dff`](https://github.com/netbirdio/netbird/commit/20e6dff507f2dc0221936894914fa943eae05c1d) Merge branch 'main' into refactor/permissions-manager - [`31d901c`](https://github.com/netbirdio/netbird/commit/31d901c4b0f5382fb781c749c3e7d78b6ee547af) update role permissions for admins ### 📊 Changes **145 files changed** (+4181 additions, -3658 deletions) <details> <summary>View changed files</summary> 📝 `client/cmd/testutil_test.go` (+3 -2) 📝 `client/internal/engine_test.go` (+2 -2) 📝 `client/server/server_test.go` (+3 -2) 📝 `go.mod` (+1 -1) 📝 `go.sum` (+2 -2) 📝 `management/internals/modules/peers/manager.go` (+2 -25) 📝 `management/internals/modules/permissions/manager.go` (+71 -7) 📝 `management/internals/modules/permissions/manager_mock.go` (+31 -9) 📝 `management/internals/modules/permissions/modules/module.go` (+0 -0) 📝 `management/internals/modules/permissions/operations/operation.go` (+0 -0) 📝 `management/internals/modules/permissions/roles/admin.go` (+3 -3) 📝 `management/internals/modules/permissions/roles/auditor.go` (+1 -1) 📝 `management/internals/modules/permissions/roles/network_admin.go` (+2 -2) 📝 `management/internals/modules/permissions/roles/owner.go` (+1 -1) 📝 `management/internals/modules/permissions/roles/role_permissions.go` (+2 -2) 📝 `management/internals/modules/permissions/roles/user.go` (+1 -1) 📝 `management/internals/modules/reverseproxy/accesslogs/manager/api.go` (+7 -10) 📝 `management/internals/modules/reverseproxy/accesslogs/manager/manager.go` (+6 -20) 📝 `management/internals/modules/reverseproxy/domain/manager/api.go` (+13 -34) 📝 `management/internals/modules/reverseproxy/domain/manager/manager.go` (+9 -54) _...and 80 more files_ </details> ### 📄 Description ## Describe your changes ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [x] It is a refactor - [ ] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Permission checks centralized into HTTP middleware; backend modules no longer perform inline permission gating and manager wiring simplified. * **Behavior** * Handlers now receive resolved user authentication consistently, yielding uniform access control behavior across endpoints. * **Tests** * Added integration tests and test fixtures; unit/integration tests updated to exercise the centralized permission wrapper and expanded account scenarios. <!-- 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 07:06:42 -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#25969