[Maps] fix users without access to Maps should not have the option to create them (#88830)
* [Maps] fix users without access to Maps should not have the option to create them * fix test message * wrap add geo field trigger in show capabilities check Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
7d50fbbf6d
commit
15a45e8c38
|
@ -160,11 +160,19 @@ export class MapsPlugin
|
||||||
|
|
||||||
public start(core: CoreStart, plugins: MapsPluginStartDependencies): MapsStartApi {
|
public start(core: CoreStart, plugins: MapsPluginStartDependencies): MapsStartApi {
|
||||||
setLicensingPluginStart(plugins.licensing);
|
setLicensingPluginStart(plugins.licensing);
|
||||||
plugins.uiActions.addTriggerAction(VISUALIZE_GEO_FIELD_TRIGGER, visualizeGeoFieldAction);
|
|
||||||
setStartServices(core, plugins);
|
setStartServices(core, plugins);
|
||||||
|
|
||||||
// unregisters the OSS alias
|
// unregisters the OSS alias
|
||||||
plugins.visualizations.unRegisterAlias(PLUGIN_ID_OSS);
|
plugins.visualizations.unRegisterAlias(PLUGIN_ID_OSS);
|
||||||
|
|
||||||
|
if (core.application.capabilities.maps.show) {
|
||||||
|
plugins.uiActions.addTriggerAction(VISUALIZE_GEO_FIELD_TRIGGER, visualizeGeoFieldAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!core.application.capabilities.maps.save) {
|
||||||
|
plugins.visualizations.unRegisterAlias(APP_ID);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
createLayerDescriptors,
|
createLayerDescriptors,
|
||||||
registerLayerWizard,
|
registerLayerWizard,
|
||||||
|
|
|
@ -12,42 +12,66 @@ export default function ({ getService, getPageObjects }) {
|
||||||
const security = getService('security');
|
const security = getService('security');
|
||||||
|
|
||||||
describe('visualize create menu', () => {
|
describe('visualize create menu', () => {
|
||||||
before(async () => {
|
describe('maps visualize alias', () => {
|
||||||
await security.testUser.setRoles(
|
describe('with write permission', () => {
|
||||||
['test_logstash_reader', 'global_maps_all', 'geoshape_data_reader', 'global_visualize_all'],
|
before(async () => {
|
||||||
false
|
await security.testUser.setRoles(['global_maps_all', 'global_visualize_all'], false);
|
||||||
);
|
|
||||||
|
|
||||||
await PageObjects.visualize.navigateToNewVisualization();
|
await PageObjects.visualize.navigateToNewVisualization();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show maps application in create menu', async () => {
|
||||||
|
const hasMapsApp = await PageObjects.visualize.hasMapsApp();
|
||||||
|
expect(hasMapsApp).to.equal(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should take users to Maps application when Maps is clicked', async () => {
|
||||||
|
await PageObjects.visualize.clickMapsApp();
|
||||||
|
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||||
|
await PageObjects.maps.waitForLayersToLoad();
|
||||||
|
const doesLayerExist = await PageObjects.maps.doesLayerExist('Road map');
|
||||||
|
expect(doesLayerExist).to.equal(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('without write permission', () => {
|
||||||
|
before(async () => {
|
||||||
|
await security.testUser.setRoles(['global_maps_read', 'global_visualize_all'], false);
|
||||||
|
|
||||||
|
await PageObjects.visualize.navigateToNewVisualization();
|
||||||
|
});
|
||||||
|
|
||||||
|
after(async () => {
|
||||||
|
await security.testUser.restoreDefaults();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not show maps application in create menu', async () => {
|
||||||
|
const hasMapsApp = await PageObjects.visualize.hasMapsApp();
|
||||||
|
expect(hasMapsApp).to.equal(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async () => {
|
describe('aggregion based visualizations', () => {
|
||||||
await security.testUser.restoreDefaults();
|
before(async () => {
|
||||||
});
|
await security.testUser.setRoles(['global_visualize_all'], false);
|
||||||
|
|
||||||
it('should show maps application in create menu', async () => {
|
await PageObjects.visualize.navigateToNewAggBasedVisualization();
|
||||||
const hasMapsApp = await PageObjects.visualize.hasMapsApp();
|
});
|
||||||
expect(hasMapsApp).to.equal(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not show legacy region map visualizion in create menu', async () => {
|
after(async () => {
|
||||||
await PageObjects.visualize.clickAggBasedVisualizations();
|
await security.testUser.restoreDefaults();
|
||||||
const hasLegecyViz = await PageObjects.visualize.hasRegionMap();
|
});
|
||||||
expect(hasLegecyViz).to.equal(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not show legacy tilemap map visualizion in create menu', async () => {
|
it('should not show legacy region map visualizion in create menu', async () => {
|
||||||
const hasLegecyViz = await PageObjects.visualize.hasTileMap();
|
const hasLegecyViz = await PageObjects.visualize.hasRegionMap();
|
||||||
expect(hasLegecyViz).to.equal(false);
|
expect(hasLegecyViz).to.equal(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should take users to Maps application when Maps is clicked', async () => {
|
it('should not show legacy tilemap map visualizion in create menu', async () => {
|
||||||
await PageObjects.visualize.goBackToGroups();
|
const hasLegecyViz = await PageObjects.visualize.hasTileMap();
|
||||||
await PageObjects.visualize.clickMapsApp();
|
expect(hasLegecyViz).to.equal(false);
|
||||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
});
|
||||||
await PageObjects.maps.waitForLayersToLoad();
|
|
||||||
const doesLayerExist = await PageObjects.maps.doesLayerExist('Road map');
|
|
||||||
expect(doesLayerExist).to.equal(true);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue