[Maps] Use client-side authc.getCurrentUser from core.security (#186915)

Part of https://github.com/elastic/kibana/issues/186574

Background: This PR serves as an example of a plugin migrating away from
depending on the Security plugin, which is a high priority effort for
the last release before 9.0. The Maps plugin uses the
`authc.getCurrentUser` in the `es_search_source` utility.

### Checklist

Delete any items that are not applicable to this PR.

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
This commit is contained in:
Tim Sullivan 2024-06-25 12:28:32 -07:00 committed by GitHub
parent d5b0ddda62
commit e7c867f34a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 2 additions and 10 deletions

View file

@ -19,12 +19,7 @@ import { Adapters } from '@kbn/inspector-plugin/common/adapters';
import { SortDirection, SortDirectionNumeric } from '@kbn/data-plugin/common';
import { getTileUrlParams } from '@kbn/maps-vector-tile-utils';
import { AbstractESSource } from '../es_source';
import {
getHttp,
getSearchService,
getSecurityService,
getTimeFilter,
} from '../../../kibana_services';
import { getCore, getHttp, getSearchService, getTimeFilter } from '../../../kibana_services';
import {
addFieldToDSL,
getField,
@ -532,7 +527,7 @@ export class ESSearchSource extends AbstractESSource implements IMvtVectorSource
if (!(await this._isDrawingIndex())) {
return {};
}
const user = await getSecurityService()?.authc.getCurrentUser();
const user = await getCore().security.authc.getCurrentUser();
const timestamp = new Date().toISOString();
return {
created: {

View file

@ -90,7 +90,6 @@ export const getUrlForApp = () => coreStart.application.getUrlForApp;
export const getNavigateToUrl = () => coreStart.application.navigateToUrl;
export const getSavedObjectsTagging = () => pluginsStart.savedObjectsTagging;
export const getPresentationUtilContext = () => pluginsStart.presentationUtil.ContextProvider;
export const getSecurityService = () => pluginsStart.security;
export const getSpacesApi = () => pluginsStart.spaces;
export const getTheme = () => coreStart.theme;
export const getApplication = () => coreStart.application;

View file

@ -36,7 +36,6 @@ import type { FileUploadPluginStart } from '@kbn/file-upload-plugin/public';
import type { PresentationUtilPluginStart } from '@kbn/presentation-util-plugin/public';
import type { SavedObjectTaggingPluginStart } from '@kbn/saved-objects-tagging-plugin/public';
import type { ChartsPluginStart } from '@kbn/charts-plugin/public';
import type { SecurityPluginStart } from '@kbn/security-plugin/public';
import type { SpacesPluginStart } from '@kbn/spaces-plugin/public';
import type { CloudSetup } from '@kbn/cloud-plugin/public';
import type { LensPublicSetup } from '@kbn/lens-plugin/public';
@ -123,7 +122,6 @@ export interface MapsPluginStartDependencies {
visualizations: VisualizationsStart;
savedObjectsTagging?: SavedObjectTaggingPluginStart;
presentationUtil: PresentationUtilPluginStart;
security?: SecurityPluginStart;
spaces?: SpacesPluginStart;
mapsEms: MapsEmsPluginPublicStart;
contentManagement: ContentManagementPublicStart;