async Task ShellScript(Boolean admin) { Response.ContentType = "application/javascript"; try { var userInfo = User.Identity.UserInfo(); if (admin && !userInfo.IsAdmin) { throw new AccessViolationException("The current user is not an administrator"); } await _baseController.ShellScript(CatalogDataSource, SetSqlQueryParamsWithoutCompany, userInfo, admin, Response.Output); } catch (Exception ex) { if (ex.InnerException != null) { ex = ex.InnerException; } if (ex.Message.StartsWith("DB1001")) /*There is no such user*/ { Response.Write($"window.location.assign('/account/login')"); } else { Response.Write($"alert('{ex.Message.EncodeJs()}')"); } } }
async Task ShellScript(Boolean admin) { Response.ContentType = "application/javascript"; try { Boolean isUserAdmin = User.Identity.IsUserAdmin(); if (admin && !isUserAdmin) { throw new AccessViolationException("The current user is not an administrator"); } await _baseController.ShellScript(CatalogDataSource, SetSqlQueryParams, User.Identity.IsUserAdmin(), admin, Response.Output); } catch (Exception ex) { if (ex.InnerException != null) { ex = ex.InnerException; } Response.Write($"alert('{ex.Message.EncodeJs()}')"); } }