diff --git a/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/file_data_visualizer_view/file_data_visualizer_view.js b/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/file_data_visualizer_view/file_data_visualizer_view.js index e36f1040447e..99b6ef602985 100644 --- a/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/file_data_visualizer_view/file_data_visualizer_view.js +++ b/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/file_data_visualizer_view/file_data_visualizer_view.js @@ -15,7 +15,11 @@ import { isEqual } from 'lodash'; import { AboutPanel, LoadingPanel } from '../about_panel'; import { BottomBar } from '../bottom_bar'; import { ResultsView } from '../results_view'; -import { FileCouldNotBeRead, FileTooLarge } from './file_error_callouts'; +import { + FileCouldNotBeRead, + FileTooLarge, + FindFileStructurePermissionDenied, +} from './file_error_callouts'; import { EditFlyout } from '../edit_flyout'; import { ExplanationFlyout } from '../explanation_flyout'; import { ImportView } from '../import_view'; @@ -50,6 +54,7 @@ export class FileDataVisualizerView extends Component { isExplanationFlyoutVisible: false, bottomBarVisible: false, hasPermissionToImport: false, + fileCouldNotBeReadPermissionError: false, }; this.overrides = {}; @@ -87,6 +92,7 @@ export class FileDataVisualizerView extends Component { fileSize: 0, fileTooLarge: false, fileCouldNotBeRead: false, + fileCouldNotBeReadPermissionError: false, serverError: null, results: undefined, explanation: undefined, @@ -182,17 +188,19 @@ export class FileDataVisualizerView extends Component { fileCouldNotBeRead: isRetry, }); } catch (error) { + const fileCouldNotBeReadPermissionError = error.body.statusCode === 403; this.setState({ results: undefined, explanation: undefined, loaded: false, loading: false, fileCouldNotBeRead: true, + fileCouldNotBeReadPermissionError, serverError: error, }); // reload the results with the previous overrides - if (isRetry === false) { + if (isRetry === false && fileCouldNotBeReadPermissionError === false) { this.setState({ loading: true, loaded: false, @@ -275,6 +283,7 @@ export class FileDataVisualizerView extends Component { isExplanationFlyoutVisible, bottomBarVisible, hasPermissionToImport, + fileCouldNotBeReadPermissionError, } = this.state; const fields = @@ -286,7 +295,12 @@ export class FileDataVisualizerView extends Component {
{mode === MODE.READ && ( <> - {!loading && !loaded && } + {!loading && !loaded && ( + + )} {loading && } @@ -296,11 +310,15 @@ export class FileDataVisualizerView extends Component { {fileCouldNotBeRead && loading === false && ( <> - + {fileCouldNotBeReadPermissionError ? ( + + ) : ( + + )} )} diff --git a/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/file_data_visualizer_view/file_error_callouts.tsx b/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/file_data_visualizer_view/file_error_callouts.tsx index 7b6378e34e78..62d860c1513e 100644 --- a/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/file_data_visualizer_view/file_error_callouts.tsx +++ b/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/file_data_visualizer_view/file_error_callouts.tsx @@ -146,3 +146,26 @@ export const Explanation: FC<{ error: FindFileStructureErrorResponse }> = ({ err ); }; + +export const FindFileStructurePermissionDenied: FC = () => { + return ( + <> + + } + color="danger" + iconType="cross" + data-test-subj="dataVisualizerFileStructurePermissionDeniedErrorCallout" + > + + + + ); +}; diff --git a/x-pack/plugins/features/server/__snapshots__/oss_features.test.ts.snap b/x-pack/plugins/features/server/__snapshots__/oss_features.test.ts.snap index e1e5776d87c7..fe5e4fb4f1e0 100644 --- a/x-pack/plugins/features/server/__snapshots__/oss_features.test.ts.snap +++ b/x-pack/plugins/features/server/__snapshots__/oss_features.test.ts.snap @@ -671,6 +671,7 @@ Array [ }, }, "api": Array [ + "fileUpload:analyzeFile", "store_search_session", ], "app": Array [ @@ -1199,6 +1200,7 @@ Array [ }, }, "api": Array [ + "fileUpload:analyzeFile", "store_search_session", ], "app": Array [ diff --git a/x-pack/plugins/features/server/oss_features.ts b/x-pack/plugins/features/server/oss_features.ts index d1e96b5a788e..f3fd934b4c3e 100644 --- a/x-pack/plugins/features/server/oss_features.ts +++ b/x-pack/plugins/features/server/oss_features.ts @@ -37,6 +37,7 @@ export const buildOSSFeatures = ({ privileges: { all: { app: ['discover', 'kibana'], + api: ['fileUpload:analyzeFile'], catalogue: ['discover'], savedObject: { all: ['search', 'query', 'index-pattern'], diff --git a/x-pack/plugins/file_upload/server/routes.ts b/x-pack/plugins/file_upload/server/routes.ts index bd3aa2688c73..c957916e7f32 100644 --- a/x-pack/plugins/file_upload/server/routes.ts +++ b/x-pack/plugins/file_upload/server/routes.ts @@ -141,7 +141,6 @@ export function fileUploadRoutes(coreSetup: CoreSetup, logge accepts: ['application/json'], maxBytes: MAX_FILE_SIZE_BYTES, }, - tags: ['access:fileUpload:import'], }, }, async (context, request, response) => { @@ -185,9 +184,6 @@ export function fileUploadRoutes(coreSetup: CoreSetup, logge validate: { body: schema.object({ index: schema.string() }), }, - options: { - tags: ['access:fileUpload:import'], - }, }, async (context, request, response) => { try { diff --git a/x-pack/plugins/maps/server/plugin.ts b/x-pack/plugins/maps/server/plugin.ts index c5fc602864f9..1119be32a04d 100644 --- a/x-pack/plugins/maps/server/plugin.ts +++ b/x-pack/plugins/maps/server/plugin.ts @@ -185,7 +185,6 @@ export class MapsPlugin implements Plugin { catalogue: [APP_ID], privileges: { all: { - api: ['fileUpload:import'], app: [APP_ID, 'kibana'], catalogue: [APP_ID], savedObject: { diff --git a/x-pack/plugins/ml/common/types/capabilities.ts b/x-pack/plugins/ml/common/types/capabilities.ts index 3545a85305c1..ef8d35e52a95 100644 --- a/x-pack/plugins/ml/common/types/capabilities.ts +++ b/x-pack/plugins/ml/common/types/capabilities.ts @@ -105,11 +105,7 @@ export function getPluginPrivileges() { return { admin: { ...privilege, - api: [ - 'fileUpload:import', - 'fileUpload:analyzeFile', - ...allMlCapabilitiesKeys.map((k) => `ml:${k}`), - ], + api: ['fileUpload:analyzeFile', ...allMlCapabilitiesKeys.map((k) => `ml:${k}`)], catalogue: [PLUGIN_ID, `${PLUGIN_ID}_file_data_visualizer`], ui: allMlCapabilitiesKeys, savedObject: {