WebClient: allow to set TLS certificates

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2024-05-03 18:30:03 +02:00
parent 58a8b2b860
commit a1af33c6aa
13 changed files with 250 additions and 97 deletions

View File

@@ -470,6 +470,7 @@ func getUserProfile(w http.ResponseWriter, r *http.Request) {
AllowAPIKeyAuth: user.Filters.AllowAPIKeyAuth,
},
PublicKeys: user.PublicKeys,
TLSCerts: user.Filters.TLSCerts,
}
render.JSON(w, r, resp)
}
@@ -492,13 +493,16 @@ func updateUserProfile(w http.ResponseWriter, r *http.Request) {
sendAPIResponse(w, r, err, "", getRespStatus(err))
return
}
if !userMerged.CanManagePublicKeys() && !userMerged.CanChangeAPIKeyAuth() && !userMerged.CanChangeInfo() {
if !userMerged.CanUpdateProfile() {
sendAPIResponse(w, r, nil, "You are not allowed to change anything", http.StatusForbidden)
return
}
if userMerged.CanManagePublicKeys() {
user.PublicKeys = req.PublicKeys
}
if userMerged.CanManageTLSCerts() {
user.Filters.TLSCerts = req.TLSCerts
}
if userMerged.CanChangeAPIKeyAuth() {
user.Filters.AllowAPIKeyAuth = req.AllowAPIKeyAuth
}