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

[Security Solution][Endpoint] Remove refresh button from policy trusted apps flyout #114974

Conversation

dasansol92
Copy link
Contributor

Summary

  • Removes refresh button on TA flyout and refactors unit test.

hide refresh button

For maintainers

@dasansol92 dasansol92 added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution auto-backport Deprecated - use backport:version if exact versions are needed v7.16.0 labels Oct 14, 2021
@dasansol92 dasansol92 requested a review from a team as a code owner October 14, 2021 10:43
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt)

Copy link
Contributor

@paul-tavares paul-tavares left a comment

Choose a reason for hiding this comment

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

Looks good. left small comment.

loading: false,
canAccessEndpointManagement: true,
canAccessFleet: false,
isPlatinumPlus: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI - a mock is already loaded when you just do:

jest.mock('../../../common/components/user_privileges/use_endpoint_privileges');

see: x-pack/plugins/security_solution/public/common/components/user_privileges/__mocks__


Not related to this PR, but

@parkiino :
I'm just seeing this now and I apologize for not having reviewed your original PR on this:
This really does not feel like the right name for a privilege. The items here (and the actual implementation) should be names that imply what the user can do, not what the system is setup for. So if this one is being used to detect if a user can do artifacts by policy, then the key should be: canUserCreateArtifactsByPolicy. this will scale better if we ever implement other restrictions (ex. page level user permissions) in that we will not have to re-implement logic in places that check for this privilege value.

We should correct this before others start using it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you want me to fix this name in this pr?

Copy link
Contributor

Choose a reason for hiding this comment

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

fixing it might have broader implication - I'm not sure how @parkiino is using it

Copy link
Contributor

Choose a reason for hiding this comment

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

just chatted with Candace - don't worry about that key for now. we'll address it in a separate PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

About the mock, is there a way to set the isPlatinumPlus to true/false just doing this jest.mock('../../../common/components/user_privileges/use_endpoint_privileges');?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, you should be able to:

jest.mock('../../../common/components/user_privileges/use_endpoint_privileges')

const useEndpointPrivilegesMock: jest.Mock = useEndpointPrivileges;

// now mock your responses
useEndpointPrivilegesMock.mockReturnValue({
  /*...*/
  isPlatinumPlus: false
});

The mock defines useEndpointPrivileges() as a mocked function, so you can override it:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ahá! got it, will do it in this pr in a bit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@paul-tavares paul-tavares left a comment

Choose a reason for hiding this comment

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

🔥 🚀

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
securitySolution 4.6MB 4.6MB +51.0B

History

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

@dasansol92 dasansol92 merged commit 8aeaa5a into elastic:master Oct 15, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 15, 2021
…ed apps flyout (elastic#114974)

* Hide refresh button by prop and refactor unit test

* Add test cases for policies selector when enable/disable license

* Remove unused code when adding mock
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Oct 15, 2021
…ed apps flyout (#114974) (#115146)

* Hide refresh button by prop and refactor unit test

* Add test cases for policies selector when enable/disable license

* Remove unused code when adding mock

Co-authored-by: David Sánchez <davidsansol92@gmail.com>
artem-shelkovnikov pushed a commit to artem-shelkovnikov/kibana that referenced this pull request Oct 20, 2021
…ed apps flyout (elastic#114974)

* Hide refresh button by prop and refactor unit test

* Add test cases for policies selector when enable/disable license

* Remove unused code when adding mock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants