-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution][Endpoint][Admin] Malware user notification is a platinum tiered feature #82894
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
22feb08
license setup in the plugin
parkiino f9d1e5b
Merge remote-tracking branch 'upstream/master' into task/license-tier…
parkiino 5413229
typechecky
parkiino ac76001
added boolean for platinum+ licenses
parkiino 9695f38
one unit test
parkiino 2d57295
test for gold tier
parkiino 8ac1d84
Merge remote-tracking branch 'upstream/master' into task/license-tier…
parkiino 05fd7a6
Merge remote-tracking branch 'upstream/master' into task/license-tier…
parkiino e32d779
missing data-test-subj
parkiino abe56e1
remove unused import from merging master
parkiino 31a6c19
Merge remote-tracking branch 'upstream/master' into task/license-tier…
parkiino db2cc4a
sigh
parkiino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
x-pack/plugins/security_solution/common/license/license.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { Observable, Subscription } from 'rxjs'; | ||
import { ILicense } from '../../../licensing/common/types'; | ||
|
||
// Generic license service class that works with the license observable | ||
// Both server and client plugins instancates a singleton version of this class | ||
export class LicenseService { | ||
private observable: Observable<ILicense> | null = null; | ||
private subscription: Subscription | null = null; | ||
private licenseInformation: ILicense | null = null; | ||
|
||
private updateInformation(licenseInformation: ILicense) { | ||
this.licenseInformation = licenseInformation; | ||
} | ||
|
||
public start(license$: Observable<ILicense>) { | ||
this.observable = license$; | ||
this.subscription = this.observable.subscribe(this.updateInformation.bind(this)); | ||
} | ||
|
||
public stop() { | ||
if (this.subscription) { | ||
this.subscription.unsubscribe(); | ||
} | ||
} | ||
|
||
public getLicenseInformation() { | ||
return this.licenseInformation; | ||
} | ||
|
||
public getLicenseInformation$() { | ||
return this.observable; | ||
} | ||
|
||
public isGoldPlus() { | ||
return ( | ||
this.licenseInformation?.isAvailable && | ||
this.licenseInformation?.isActive && | ||
this.licenseInformation?.hasAtLeast('gold') | ||
); | ||
} | ||
public isPlatinumPlus() { | ||
return ( | ||
this.licenseInformation?.isAvailable && | ||
this.licenseInformation?.isActive && | ||
this.licenseInformation?.hasAtLeast('platinum') | ||
); | ||
} | ||
public isEnterprise() { | ||
return ( | ||
this.licenseInformation?.isAvailable && | ||
this.licenseInformation?.isActive && | ||
this.licenseInformation?.hasAtLeast('enterprise') | ||
); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
x-pack/plugins/security_solution/public/common/hooks/use_license.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { LicenseService } from '../../../common/license/license'; | ||
|
||
export const licenseService = new LicenseService(); | ||
|
||
export function useLicense() { | ||
return licenseService; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
x-pack/plugins/security_solution/server/lib/license/license.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { LicenseService } from '../../../common/license/license'; | ||
|
||
export const licenseService = new LicenseService(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to impact the Cases? I see that line 315 was also removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no i did not. i got a typecheck error and i wasn't sure if it was a failed merge from master. i'm going to add it back in because this was probs a mistake on my end