-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Security Solution][Endpoint] Remove refresh button from policy trusted apps flyout #114974
Conversation
Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt) |
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.
Looks good. left small comment.
loading: false, | ||
canAccessEndpointManagement: true, | ||
canAccessFleet: false, | ||
isPlatinumPlus: true, |
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.
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.
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.
Do you want me to fix this name in this pr?
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.
fixing it might have broader implication - I'm not sure how @parkiino is using it
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.
just chatted with Candace - don't worry about that key for now. we'll address it in a separate PR
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.
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');
?
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.
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:
Line 10 in d50ec56
export const useEndpointPrivileges = jest.fn(() => { |
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.
ahá! got it, will do it in this pr in a bit
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.
@paul-tavares done in b876996
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.
🔥 🚀
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
…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
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…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
Summary
For maintainers