Skip to content

Commit

Permalink
[data.search] Add user information to background session service (#84975
Browse files Browse the repository at this point in the history
)

* [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
  • Loading branch information
lukasolson authored Feb 13, 2021
1 parent 874fadf commit 104eacb
Show file tree
Hide file tree
Showing 8 changed files with 838 additions and 196 deletions.
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
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/data_enhanced/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
5 changes: 4 additions & 1 deletion x-pack/plugins/data_enhanced/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ export const searchSessionMapping: SavedObjectsType = {
type: 'object',
enabled: false,
},
realmType: {
type: 'keyword',
},
realmName: {
type: 'keyword',
},
username: {
type: 'keyword',
},
},
},
};
Loading

0 comments on commit 104eacb

Please sign in to comment.