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

[Search Session] Control "Kibana / Search Sessions" management section by privileges #90818

Merged

Conversation

Dosant
Copy link
Contributor

@Dosant Dosant commented Feb 9, 2021

Summary

Closes #89833

This pr hides "Kibana / Search Sessions" management section in case there is no app that allows to use search session following this recommendation.

This is how it looks inside the app for such case (there are tooltips on disabled buttons):
Screenshot 2021-02-09 at 18 16 07

Checklist

Delete any items that are not applicable to this PR.

For maintainers

// in case user doesn't have permissions to search session, do not forward sessionId to the server
// because user most likely also doesn't have access to `search-session` SO
if (!this.hasAccessToSearchSessions) {
return null;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed that after this pr #89570 we track all searches in es and trackId would through in case a user doesn't have access to search-session SO.
To avoid this ensure we don't send sessionId to the server in case a user doesn't have access to work with sessions

@Dosant Dosant added Feature:Search Querying infrastructure in Kibana Team:AppServices v7.12.0 v8.0.0 release_note:skip Skip the PR/issue when compiling release notes labels Feb 9, 2021
@Dosant Dosant marked this pull request as ready for review February 9, 2021 21:06
@Dosant Dosant requested a review from a team February 9, 2021 21:06
@Dosant Dosant requested review from a team as code owners February 9, 2021 21:06
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major LGTM

const managementMenu = getService('managementMenu');

describe('Search sessions Management UI permissions', () => {
describe('Sessions management is not available if non of apps enable search sessions', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@Dosant
Copy link
Contributor Author

Dosant commented Feb 10, 2021

@elasticmachine merge upstream

Copy link
Member

@Bamieh Bamieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -48,6 +48,8 @@ export const metricsRequestHandler = async ({
});

try {
const searchSessionOptions =
searchSessionId && dataSearch.session.getSearchOptions(searchSessionId);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getSearchOptions can return null now. TSVB route validation fails in case we send
searchSession: null, so this change just makes sure searchSession key is not send in case getSearchOptions returns null

@@ -94,6 +94,8 @@ export function getTimelionRequestHandler({
});

try {
const searchSessionOptions =
searchSessionId && dataSearch.session.getSearchOptions(searchSessionId);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getSearchOptions can return null now. timelion route validation fails in case we send
searchSession: null, so this change just makes sure searchSession key is not send in case getSearchOptions returns null

@Dosant
Copy link
Contributor Author

Dosant commented Feb 11, 2021

@elasticmachine merge upstream

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kibana app changes, LGTM!

@Dosant Dosant enabled auto-merge (squash) February 11, 2021 09:14
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
data 613 614 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dataEnhanced 160.1KB 160.4KB +268.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 797.9KB 798.6KB +747.0B
dataEnhanced 37.9KB 38.7KB +771.0B
visTypeTimelion 25.3KB 25.4KB +53.0B
visTypeTimeseries 126.7KB 126.8KB +53.0B
total +1.6KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@Dosant Dosant merged commit 9ab5bcb into elastic:master Feb 11, 2021
Dosant added a commit to Dosant/kibana that referenced this pull request Feb 11, 2021
gmmorris added a commit to gmmorris/kibana that referenced this pull request Feb 11, 2021
* master: (44 commits)
  [APM] Add experimental support for Data Streams (elastic#89650)
  [Search Session] Control "Kibana / Search Sessions" management section by privileges (elastic#90818)
  [Lens] Median as default function (elastic#90952)
  Implement custom global header banner (elastic#87438)
  [Fleet] Reduce permissions. (elastic#90302)
  Update dependency @elastic/charts to v24.5.1 (elastic#89822)
  [Create index pattern] Can't create single character index without wildcard (elastic#90919)
  [ts/build_ts_refs] add support for --clean flag (elastic#91060)
  Don't clean when running e2e tests (elastic#91057)
  Fixes track_total_hits in the body not having an effect when using search strategy (elastic#91068)
  [Security Solution][Detections] Adds list plugin Saved Objects to Security feature privilege (elastic#90895)
  Removing the code plugin entirely for 8.0 (elastic#77940)
  chore(NA): move the instruction to remove yarn global bazelisk package into the first place on install bazel tools (elastic#91026)
  [jest/ci] remove max-old-space-size override to use 4gb default (elastic#91020)
  [Fleet] Restrict integration changes for managed policies (elastic#90675)
  [CI] Fix auto-backport condditions so that it doesn't trigger for other labels (elastic#91042)
  [DOCS] Uses variable to refer to query profiler (elastic#90976)
  [App Search] Relevance Tuning logic listeners (elastic#89461)
  [Metrics UI] Fix saving/loading saved views from URL (elastic#90216)
  Limit cardinality of transaction.name (elastic#90955)
  ...
Dosant added a commit that referenced this pull request Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Search Querying infrastructure in Kibana release_note:skip Skip the PR/issue when compiling release notes v7.12.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stack Management / Kibana / Search Sessions menu entry not controlled by privileges
6 participants