NET-152 enrollment keys for non admins (#2346)

* return 401 instead of 403

* fixed http.StatusForbidden

* Tagged build version (temp)

* Unauthorized_Err when applicable

* untagged version

* fixed PUT /api/users/networks/user1

* - expired token redirs to login
- added `/api/enrollment_keys` for non-admins
- unit test for enrollment keys for non-admins

* handle user perms in `/hosts`

* removed debug

* misc

* - support masteradmin
- return hosts with partial access

* added `ismaster` to middleware
This commit is contained in:
Tobias Cudnik
2023-05-31 09:41:54 +02:00
committed by GitHub
parent 6f11eb2bb0
commit 723375b334
10 changed files with 161 additions and 14 deletions

View File

@@ -148,6 +148,7 @@ retry:
if res.StatusCode == http.StatusUnauthorized && !retried && ctx.MasterKey == "" {
req.Header.Set("Authorization", "Bearer "+getAuthToken(ctx, true))
retried = true
// TODO add a retry limit, drop goto
goto retry
}
resBodyBytes, err := io.ReadAll(res.Body)