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

fix(GetUserPreferences): Return 401 if identity type is not valid
This commit is contained in:
xavi
2025-07-09 08:35:18 +02:00
committed by GitHub
parent 20c700dd52
commit e4743a9092
+1 -1
View File
@@ -74,7 +74,7 @@ func (hs *HTTPServer) SetHomeDashboard(c *contextmodel.ReqContext) response.Resp
func (hs *HTTPServer) GetUserPreferences(c *contextmodel.ReqContext) response.Response {
userID, err := identity.UserIdentifier(c.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, hs.Features, c.GetOrgID(), userID, 0)