Skip to content
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

[management] Restrict accessible peers to user-owned peers for non-admins #2618

Merged
merged 5 commits into from
Sep 20, 2024

Conversation

bcmmbaga
Copy link
Contributor

Describe your changes

Issue ticket number and link

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

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
@bcmmbaga bcmmbaga force-pushed the add-accessible-peers-role-permissions branch from 224641a to 0a941f4 Compare September 18, 2024 17:59
management/server/http/peers_handler_test.go Show resolved Hide resolved
@@ -228,6 +228,20 @@ func (h *PeersHandler) GetAccessiblePeers(w http.ResponseWriter, r *http.Request
return
}

if !user.HasAdminPower() && !user.IsServiceUser {
peer, err := h.accountManager.GetPeer(r.Context(), account.Id, peerID, user.Id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are introducing an unnecessary get account here. I suggest either optimizing the GetPeer or reusing the account in line 218, but consider PR #2615

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
Copy link

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
@bcmmbaga bcmmbaga merged commit 35c892a into main Sep 20, 2024
20 checks passed
@bcmmbaga bcmmbaga deleted the add-accessible-peers-role-permissions branch September 20, 2024 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants