mas: implemented PUT /admin/v2/users/{userID} endpoint

MAS requires this endpoint to fetch the data for the account management page
This commit is contained in:
Roman Isaev 2024-12-30 17:14:04 +00:00
parent 9ebcebee43
commit be8d490e56
No known key found for this signature in database
GPG key ID: 7BE2B6A6C89AEC7F
5 changed files with 95 additions and 12 deletions

View file

@ -344,9 +344,16 @@ func Setup(
})).Methods(http.MethodGet)
synapseAdminRouter.Handle("/admin/v2/users/{userID}",
httputil.MakeServiceAdminAPI("admin_provision_user", m.AdminToken, func(r *http.Request) util.JSONResponse {
return AdminCreateOrModifyAccount(r, userAPI)
})).Methods(http.MethodPut)
httputil.MakeServiceAdminAPI("admin_manage_user", m.AdminToken, func(r *http.Request) util.JSONResponse {
switch r.Method {
case http.MethodGet:
return AdminRetrieveAccount(r, cfg, userAPI)
case http.MethodPut:
return AdminCreateOrModifyAccount(r, userAPI)
default:
return util.JSONResponse{Code: http.StatusMethodNotAllowed, JSON: nil}
}
})).Methods(http.MethodPut, http.MethodGet)
synapseAdminRouter.Handle("/admin/v2/users/{userID}/devices",
httputil.MakeServiceAdminAPI("admin_user_devices", m.AdminToken, func(r *http.Request) util.JSONResponse {