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

Reduce license plugin api #53489

Merged
merged 15 commits into from
Dec 19, 2019
Merged

Conversation

mshustov
Copy link
Contributor

@mshustov mshustov commented Dec 18, 2019

Summary

Reduces license API surface: isBasic, isNotBasic, isOneOf are superseded by hasAtLeast as it reflects the hierarchical nature of the stack licenses.
Adds License mocks.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

Dev docs

License method isOneOf was superseded by hasAtLeast that checks the current license is not less than passes minimal required license.

//before
license.isOneOf(['platinum', 'enterprise', 'trial'])
// after
license.isOneOf('platinum')

@mshustov mshustov marked this pull request as ready for review December 18, 2019 15:33
@mshustov mshustov requested review from a team as code owners December 18, 2019 15:33
@mshustov mshustov added Feature:New Platform release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.6.0 labels Dec 18, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@@ -8,31 +8,31 @@ import { ILicense } from '../../../../../../../plugins/licensing/server';
import { licenseCheck } from '../license';

describe('license check', () => {
let mockLicense: Pick<ILicense, 'isActive' | 'isOneOf'>;
let mockLicense: Pick<ILicense, 'isActive' | 'hasAtLeast'>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@justinkambic looks like we should update CODEOWNERS to make uptime owner of the plugin

@elasticmachine elasticmachine mentioned this pull request Dec 18, 2019
12 tasks
x-pack/plugins/licensing/common/types.ts Outdated Show resolved Hide resolved
x-pack/plugins/licensing/common/license_update.test.ts Outdated Show resolved Hide resolved
Co-Authored-By: Larry Gregory <lgregorydev@gmail.com>
Copy link
Member

@legrego legrego left a comment

Choose a reason for hiding this comment

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

Security changes LGTM

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

History

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

@mshustov mshustov merged commit ba7589d into elastic:master Dec 19, 2019
@mshustov mshustov deleted the reduce-license-plugin-api branch December 19, 2019 08:35
mshustov added a commit to mshustov/kibana that referenced this pull request Dec 19, 2019
* inOneOf --> hasAtLeast. to follow to licensing hierarchical model

* adopt licensing tests

* add license mock and use it in the tests

* adopt security plugin to hasAtLeast and licensing mocks

* adopt uptime to hasAtLeast

* update readme

* add test for unknown license

* fix import in js test

* fix security plugin merge conflict

* Update x-pack/plugins/security/common/licensing/license_service.ts

Co-Authored-By: Larry Gregory <lgregorydev@gmail.com>

* Update x-pack/plugins/licensing/common/types.ts

Co-Authored-By: Josh Dover <me@joshdover.com>

* simplify tests

* remove unused import
mshustov added a commit that referenced this pull request Dec 19, 2019
* inOneOf --> hasAtLeast. to follow to licensing hierarchical model

* adopt licensing tests

* add license mock and use it in the tests

* adopt security plugin to hasAtLeast and licensing mocks

* adopt uptime to hasAtLeast

* update readme

* add test for unknown license

* fix import in js test

* fix security plugin merge conflict

* Update x-pack/plugins/security/common/licensing/license_service.ts

Co-Authored-By: Larry Gregory <lgregorydev@gmail.com>

* Update x-pack/plugins/licensing/common/types.ts

Co-Authored-By: Josh Dover <me@joshdover.com>

* simplify tests

* remove unused import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Feature:New Platform release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants