[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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user