[release-11.2.11] IAM: Return 401 if identity type is not valid in GetUserPreferences (#107823)

IAM: Return 401 if identity type is not valid in GetUserPreferences (#107760)

fix(GetUserPreferences): Return 401 if identity type is not valid

(cherry picked from commit e4743a9092)
This commit is contained in:
grafana-delivery-bot[bot]
2025-07-09 07:59:06 +01:00
committed by GitHub
parent 424451d706
commit 6590c3eea8
+1 -1
View File
@@ -66,7 +66,7 @@ func (hs *HTTPServer) SetHomeDashboard(c *contextmodel.ReqContext) response.Resp
func (hs *HTTPServer) GetUserPreferences(c *contextmodel.ReqContext) response.Response {
userID, err := identity.UserIdentifier(c.SignedInUser.GetID())
if err != nil {
return response.Error(http.StatusInternalServerError, "Failed to update user preferences", err)
return response.Error(http.StatusUnauthorized, "Not a valid identity", err)
}
return prefapi.GetPreferencesFor(c.Req.Context(), hs.DashboardService, hs.preferenceService, c.SignedInUser.GetOrgID(), userID, 0)