Returns the user's login type. This only works if the api key for authorization and the requested user match. Eg: 'me' @Summary Get user login type @ID get-user-login-type @Security CoderSessionToken @Produce json @Tags Users @Param user path string true "User ID, name, or me" @Success 200 {object}
(rw http.ResponseWriter, r *http.Request)
| 837 | // @Success 200 {object} codersdk.UserLoginType |
| 838 | // @Router /api/v2/users/{user}/login-type [get] |
| 839 | func (*API) userLoginType(rw http.ResponseWriter, r *http.Request) { |
| 840 | var ( |
| 841 | ctx = r.Context() |
| 842 | user = httpmw.UserParam(r) |
| 843 | key = httpmw.APIKey(r) |
| 844 | ) |
| 845 | |
| 846 | if key.UserID != user.ID { |
| 847 | // Currently this is only valid for querying yourself. |
| 848 | httpapi.Write(ctx, rw, http.StatusForbidden, codersdk.Response{ |
| 849 | Message: "You are not authorized to view this user's login type.", |
| 850 | }) |
| 851 | return |
| 852 | } |
| 853 | |
| 854 | httpapi.Write(ctx, rw, http.StatusOK, codersdk.UserLoginType{ |
| 855 | LoginType: codersdk.LoginType(user.LoginType), |
| 856 | }) |
| 857 | } |
| 858 | |
| 859 | // @Summary Update user profile |
| 860 | // @ID update-user-profile |