-
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
Fleet Privileges Display #204402
base: main
Are you sure you want to change the base?
Fleet Privileges Display #204402
Conversation
/ci |
1 similar comment
/ci |
@elasticmachine merge upstream |
/ci |
Pinging @elastic/kibana-security (Team:Security) |
ACK: will review today, sorry for the delay! |
@@ -218,7 +218,7 @@ export class SpaceAwarePrivilegeSection extends Component<Props, State> { | |||
const viewMatrixButton = ( | |||
<PrivilegeSummary | |||
role={this.props.role} | |||
spaces={this.getDisplaySpaces()} | |||
spaces={this.getSelectedSpaces()} |
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.
Caution
There is something definitely off here when I select different access variations. See the video. Do you see the same?
Screen.Recording.2024-12-24.at.14.16.13.mov
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.
Confirmed, can reproduce, will take a look
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.
6c631b4 pushed fix, but please hold on review for now, need to check tests
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.
@azasypkin ready for review 🙂
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.
Nice! I'll review on Monday
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.
It looks like we have another issue now. If Read/All access to Fleet is granted through a Kibana privilege entry with “All Spaces”, the privilege summary for any space-specific privileges should reflect what is granted by the “All Spaces” privilege.
Screen.Recording.2024-12-30.at.16.01.07.mov
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.
Screen.Recording.2024-12-31.at.11.34.58.mov
@azasypkin pushed a fix and checked it with multiple spaces, should work as expected 🙌
@elasticmachine merge upstream |
@@ -52,7 +52,7 @@ function showPrivilege(allSpacesSelected: boolean, primaryFeature?: PrimaryFeatu | |||
if ( | |||
primaryFeature?.name == null || | |||
primaryFeature?.disabled || | |||
(primaryFeature.requireAllSpaces && !allSpacesSelected) | |||
(primaryFeature?.requireAllSpaces && !allSpacesSelected) | |||
) { | |||
return 'None'; |
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.
question: I know it was here before your PR, but shouldn't None
be a localized string instead of hardcoded English one?
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.
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.
Interesting, thanks for checking. I wonder if that was a deliberate decision. In any case, it’s outside the scope of this PR.
@@ -210,11 +212,20 @@ export const PrivilegeSummaryTable = (props: PrivilegeSummaryTableProps) => { | |||
</EuiFlexGroup> | |||
); | |||
|
|||
const categoryPrivileges = Object.keys(privileges).reduce((acc, key) => { |
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.
optional nit: since you retrieve value using the key anyway, Object.values
might have been a slightly better choice. Or even something like this would be simpler:
const categoryPrivileges = Object.fromEntries(
Object.entries(privileges).map(([key, [, featurePrivileges]]) => [key, featurePrivileges])
);
@@ -218,7 +218,7 @@ export class SpaceAwarePrivilegeSection extends Component<Props, State> { | |||
const viewMatrixButton = ( | |||
<PrivilegeSummary | |||
role={this.props.role} | |||
spaces={this.getDisplaySpaces()} | |||
spaces={this.getSelectedSpaces()} |
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.
It looks like we have another issue now. If Read/All access to Fleet is granted through a Kibana privilege entry with “All Spaces”, the privilege summary for any space-specific privileges should reflect what is granted by the “All Spaces” privilege.
Screen.Recording.2024-12-30.at.16.01.07.mov
64cb61d
to
017dad8
Compare
017dad8
to
ab901f5
Compare
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 like we have a new weird behavior 😬
There are so many edge cases, and it’s very tricky to handle them all. It would be even trickier to ensure they aren’t accidentally broken in the future. Thanks for updating the tests to include more cases. We might need to incorporate all these cases into our unit or functional tests, even if they are specifically around Fleet.
Screen.Recording.2025-01-06.at.15.41.15.mov
45cfb91
to
f0c1c9b
Compare
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
History
|
Summary
Fixed privileges display for features/subFeatures that require all spaces.
Before
Role privileges display for only
Default
space selectedPrivileges summary display for only
Default
space selectedAfter
Role privileges display for only
Default
space selectedPrivileges summary display for only
Default
space selectedHow to test
With
Default
space:Default
Space and the privilege level to All.None
.None
.With
*All Spaces
:*All Spaces
and the privilege level to All.All
All
Checklist
Check the PR satisfies following conditions.
release_note:*
label is applied per the guidelinesFixes: #194686
Release Note
Fixed privileges display for features/subFeatures that require all spaces.