[PR #846] [MERGED] Block user through HTTP API #13068

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/846
Author: @braginini
Created: 5/9/2023
Status: Merged
Merged: 5/11/2023
Merged by: @braginini

Base: mainHead: feature/block_user


📝 Commits (10+)

  • c8fa3cb Add user block check to the HTTP API
  • 7b26868 Fix user copy test
  • 62e3f48 Forbid blocked users to enroll machines
  • 00d9678 Block user via HTTP API
  • 29b7bb1 Add user update HTTP test
  • 679caf3 Fix Codacy
  • 4a676ca Disconnect peers of a blocked user
  • 4e1c81e Add save user test
  • 8225172 Merge remote-tracking branch 'origin/main' into feature/block_user
  • 020a393 Extend user save test

📊 Changes

13 files changed (+503 additions, -153 deletions)

View changed files

📝 management/server/account.go (+9 -8)
📝 management/server/activity/codes.go (+16 -0)
📝 management/server/http/api/openapi.yml (+10 -2)
📝 management/server/http/api/types.gen.go (+11 -3)
📝 management/server/http/handler.go (+1 -1)
📝 management/server/http/middleware/access_control.go (+16 -8)
📝 management/server/http/pat_handler_test.go (+4 -4)
📝 management/server/http/users_handler.go (+13 -1)
📝 management/server/http/users_handler_test.go (+136 -1)
📝 management/server/mock_server/account_mock.go (+21 -21)
📝 management/server/peer.go (+23 -0)
📝 management/server/user.go (+130 -74)
📝 management/server/user_test.go (+113 -30)

📄 Description

Describe your changes

The new functionality allows to block a user in the Management service .
Blocked users loose access to the Dashboard, aren't able to modify network map,
and all of their connected devices disconnect and set to "login expired" state.

Technically all above achieved with the updated PUT /api/users endpoint,
that was extended with is_blocked field.

image

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/846 **Author:** [@braginini](https://github.com/braginini) **Created:** 5/9/2023 **Status:** ✅ Merged **Merged:** 5/11/2023 **Merged by:** [@braginini](https://github.com/braginini) **Base:** `main` ← **Head:** `feature/block_user` --- ### 📝 Commits (10+) - [`c8fa3cb`](https://github.com/netbirdio/netbird/commit/c8fa3cb9dab451647a883bcd62d538e52d9c6a36) Add user block check to the HTTP API - [`7b26868`](https://github.com/netbirdio/netbird/commit/7b2686803a8e74ee634eea84e7a993e5a9891766) Fix user copy test - [`62e3f48`](https://github.com/netbirdio/netbird/commit/62e3f48a7c5381dc06db077e69d43cd0891f9d06) Forbid blocked users to enroll machines - [`00d9678`](https://github.com/netbirdio/netbird/commit/00d967855ff7286954feb5c4cf9fa873e9c47f76) Block user via HTTP API - [`29b7bb1`](https://github.com/netbirdio/netbird/commit/29b7bb15cb0cc5d779781d9c3b1a1885bd1e6ac3) Add user update HTTP test - [`679caf3`](https://github.com/netbirdio/netbird/commit/679caf3b8dfcbb28c871227f1479d40720a91f78) Fix Codacy - [`4a676ca`](https://github.com/netbirdio/netbird/commit/4a676ca562a9d3e1cd41278c8408182bfa77e5ff) Disconnect peers of a blocked user - [`4e1c81e`](https://github.com/netbirdio/netbird/commit/4e1c81eca41d85d17c4f01d2cf99f20affa2a2b9) Add save user test - [`8225172`](https://github.com/netbirdio/netbird/commit/8225172c160dbcefa33a7d005a8e85d59d05aa66) Merge remote-tracking branch 'origin/main' into feature/block_user - [`020a393`](https://github.com/netbirdio/netbird/commit/020a393239f8ed933922ac7cf6877878bf827d94) Extend user save test ### 📊 Changes **13 files changed** (+503 additions, -153 deletions) <details> <summary>View changed files</summary> 📝 `management/server/account.go` (+9 -8) 📝 `management/server/activity/codes.go` (+16 -0) 📝 `management/server/http/api/openapi.yml` (+10 -2) 📝 `management/server/http/api/types.gen.go` (+11 -3) 📝 `management/server/http/handler.go` (+1 -1) 📝 `management/server/http/middleware/access_control.go` (+16 -8) 📝 `management/server/http/pat_handler_test.go` (+4 -4) 📝 `management/server/http/users_handler.go` (+13 -1) 📝 `management/server/http/users_handler_test.go` (+136 -1) 📝 `management/server/mock_server/account_mock.go` (+21 -21) 📝 `management/server/peer.go` (+23 -0) 📝 `management/server/user.go` (+130 -74) 📝 `management/server/user_test.go` (+113 -30) </details> ### 📄 Description ## Describe your changes The new functionality allows to block a user in the Management service . Blocked users loose access to the Dashboard, aren't able to modify network map, and all of their connected devices disconnect and set to "login expired" state. Technically all above achieved with the updated PUT /api/users endpoint, that was extended with is_blocked field. ![image](https://github.com/netbirdio/netbird/assets/700848/5060cf4c-29ad-43b0-a51e-7559452626b7) ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] 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 02:07:23 -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#13068