MCPcopy
hub / github.com/devtron-labs/devtron / HandleUnauthorized

Function HandleUnauthorized

api/restHandler/common/EnhancedErrorResponse.go:212–216  ·  view source on GitHub ↗

HandleUnauthorized handles unauthorized access errors

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

210
211// HandleUnauthorized handles unauthorized access errors
212func HandleUnauthorized(w http.ResponseWriter, r *http.Request) {
213 apiErr := util.NewApiError(http.StatusUnauthorized, "Unauthorized access", "unauthorized").
214 WithCode("11010")
215 WriteJsonResp(w, apiErr, nil, apiErr.HttpStatusCode)
216}
217
218// HandleForbidden handles forbidden access errors
219func HandleForbidden(w http.ResponseWriter, r *http.Request, resource string) {

Callers 15

CMGlobalAddUpdateMethod · 0.92
CMGlobalFetchMethod · 0.92
CMGlobalFetchForEditMethod · 0.92
CMEnvironmentFetchMethod · 0.92
CSGlobalAddUpdateMethod · 0.92
CSGlobalFetchMethod · 0.92
CSEnvironmentFetchMethod · 0.92
CMGlobalDeleteMethod · 0.92
CMEnvironmentDeleteMethod · 0.92

Calls 3

NewApiErrorFunction · 0.92
WriteJsonRespFunction · 0.85
WithCodeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…