Service Accounts: Don't show error pop-ups for Service Account and Renderer UI flows (#101776)

* don't show error pop-ups for SAs and renderer

* only hide non 4xx error pop'ups

* linting
This commit is contained in:
Ieva
2025-03-07 13:37:26 +00:00
committed by GitHub
parent 14ebec527c
commit 392124de00
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -505,7 +505,7 @@ func (hs *HTTPServer) ChangeActiveOrgAndRedirectToHome(c *contextmodel.ReqContex
if !c.SignedInUser.IsIdentityType(claims.TypeUser) {
hs.log.Debug("Requested endpoint only available to users")
c.JsonApiErr(http.StatusForbidden, "Endpoint only available for users", nil)
c.JsonApiErr(http.StatusNotModified, "Endpoint only available for users", nil)
return
}
@@ -631,7 +631,7 @@ func (hs *HTTPServer) ClearHelpFlags(c *contextmodel.ReqContext) response.Respon
func (hs *HTTPServer) getUserID(c *contextmodel.ReqContext) (int64, *response.NormalResponse) {
if !c.SignedInUser.IsIdentityType(claims.TypeUser) {
hs.log.Debug("Requested endpoint only available to users")
return 0, response.Error(http.StatusForbidden, "Endpoint only available for users", nil)
return 0, response.Error(http.StatusNotModified, "Endpoint only available for users", nil)
}
userID, err := c.SignedInUser.GetInternalID()
+2 -1
View File
@@ -347,8 +347,9 @@ export class BackendSrv implements BackendService {
}
showErrorAlert(config: BackendSrvRequest, err: FetchError) {
// do not show error alerts for api keys or render tokens, they are used for kiosk mode and reporting and can't react to error pop-ups
// do not show non-user error alerts for api keys or render tokens, they are used for kiosk mode and reporting and can't react to error pop-ups
if (
(err.status < 400 || err.status >= 500) &&
this.dependencies.contextSrv.isSignedIn &&
(this.dependencies.contextSrv.user.authenticatedBy === 'apikey' ||
this.dependencies.contextSrv.user.authenticatedBy === 'render')