MCPcopy Index your code
hub / github.com/coder/coder / userLoginType

Method userLoginType

coderd/users.go:839–857  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

837// @Success 200 {object} codersdk.UserLoginType
838// @Router /api/v2/users/{user}/login-type [get]
839func (*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

Callers

nothing calls this directly

Calls 5

UserParamFunction · 0.92
APIKeyFunction · 0.92
WriteFunction · 0.92
LoginTypeTypeAlias · 0.92
ContextMethod · 0.65

Tested by

no test coverage detected