Skip to content

Commit 12f4f6d

Browse files
authored
[Maps] fix read only badge is no longer shown in nav for users with read-only permission (#76091)
1 parent 51fd423 commit 12f4f6d

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

x-pack/plugins/maps/public/routing/maps_router.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
import React from 'react';
88
import { render, unmountComponentAtNode } from 'react-dom';
99
import { Router, Switch, Route, Redirect } from 'react-router-dom';
10-
import { getCoreI18n, getToasts, getEmbeddableService } from '../kibana_services';
10+
import { i18n } from '@kbn/i18n';
11+
import {
12+
getCoreChrome,
13+
getCoreI18n,
14+
getMapsCapabilities,
15+
getToasts,
16+
getEmbeddableService,
17+
} from '../kibana_services';
1118
import {
1219
createKbnUrlStateStorage,
1320
withNotifyOnErrors,
@@ -44,6 +51,18 @@ const App = ({ history, appBasePath, onAppLeave }) => {
4451
const { originatingApp } =
4552
stateTransfer?.getIncomingEditorState({ keysToRemoveAfterFetch: ['originatingApp'] }) || {};
4653

54+
if (!getMapsCapabilities().save) {
55+
getCoreChrome().setBadge({
56+
text: i18n.translate('xpack.maps.badge.readOnly.text', {
57+
defaultMessage: 'Read only',
58+
}),
59+
tooltip: i18n.translate('xpack.maps.badge.readOnly.tooltip', {
60+
defaultMessage: 'Unable to save maps',
61+
}),
62+
iconType: 'glasses',
63+
});
64+
}
65+
4766
return (
4867
<I18nContext>
4968
<Provider store={store}>

x-pack/test/functional/apps/maps/feature_controls/maps_security.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
181181
await testSubjects.missingOrFail('checkboxSelectAll');
182182
});
183183

184-
// This behavior was removed when the Maps app was migrated to NP
185-
it.skip(`shows read-only badge`, async () => {
184+
it(`shows read-only badge`, async () => {
186185
await globalNav.badgeExistsOrFail('Read only');
187186
});
188187

0 commit comments

Comments
 (0)