Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] [data.search] Add user information to background session service (#84975) #91327

Merged
merged 1 commit into from
Feb 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[data.search] Add user information to background session service (#84975
)

* [data.search] Move search method inside session service and add tests

* Move background session service to data_enhanced plugin

* Fix types

* [data.search] Add user information to background session service

* Update trackId & getId to accept user

* Fix remaining merge conflicts

* Fix test

* Remove todos

* Fix session service to use user

* Remove user conflicts and update SO filter

* Allow filter as string or KQL node

* Add back user checks

* Add API integration tests

* Remove unnecessary get calls
lukasolson authored and Liza K committed Feb 13, 2021
commit 6edcba70578a133cab1a05589595e39ce9468ce1
6 changes: 6 additions & 0 deletions x-pack/plugins/data_enhanced/common/search/session/types.ts
Original file line number Diff line number Diff line change
@@ -57,6 +57,12 @@ export interface SearchSessionSavedObjectAttributes {
* This value is true if the session was actively stored by the user. If it is false, the session may be purged by the system.
*/
persisted: boolean;
/**
* The realm type/name & username uniquely identifies the user who created this search session
*/
realmType?: string;
realmName?: string;
username?: string;
}

export interface SearchSessionRequestInfo {
2 changes: 1 addition & 1 deletion x-pack/plugins/data_enhanced/kibana.json
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
"kibanaVersion": "kibana",
"configPath": ["xpack", "data_enhanced"],
"requiredPlugins": ["bfetch", "data", "features", "management", "share", "taskManager"],
"optionalPlugins": ["kibanaUtils", "usageCollection"],
"optionalPlugins": ["kibanaUtils", "usageCollection", "security"],
"server": true,
"ui": true,
"requiredBundles": ["kibanaUtils", "kibanaReact"]
5 changes: 4 additions & 1 deletion x-pack/plugins/data_enhanced/server/plugin.ts
Original file line number Diff line number Diff line change
@@ -24,12 +24,15 @@ import {
import { getUiSettings } from './ui_settings';
import type { DataEnhancedRequestHandlerContext } from './type';
import { ConfigSchema } from '../config';
import { SecurityPluginSetup } from '../../security/server';

interface SetupDependencies {
data: DataPluginSetup;
usageCollection?: UsageCollectionSetup;
taskManager: TaskManagerSetupContract;
security?: SecurityPluginSetup;
}

export interface StartDependencies {
data: DataPluginStart;
taskManager: TaskManagerStartContract;
@@ -67,7 +70,7 @@ export class EnhancedDataServerPlugin
eqlSearchStrategyProvider(this.logger)
);

this.sessionService = new SearchSessionService(this.logger, this.config);
this.sessionService = new SearchSessionService(this.logger, this.config, deps.security);

deps.data.__enhance({
search: {
Original file line number Diff line number Diff line change
@@ -53,6 +53,15 @@ export const searchSessionMapping: SavedObjectsType = {
type: 'object',
enabled: false,
},
realmType: {
type: 'keyword',
},
realmName: {
type: 'keyword',
},
username: {
type: 'keyword',
},
},
},
};
Loading