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

Fix permissions for group edit buttons #7056

Merged
merged 6 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Fixed the `Open report` button of the toast and the `Download report` icon of the reporting table in Safari [#7019](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7019)
- Fixed style when unnpinned an agent in endpoint summary section [#7015](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7015)
- Fixed overflow style on a long value filter [#7021](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7021)
- Fixed buttons enabled for a readonly user in `Endpoint groups` section [#7056](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7056)

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ exports[`AgentStatus component Renders status indicator with the its color and t
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M8 14A6 6 0 1 1 8 2a6 6 0 0 1 0 12Zm0-1A5 5 0 1 0 8 3a5 5 0 0 0 0 10Zm-.186-1.065A.785.785 0 0 1 7 11.12c0-.48.34-.82.814-.82.475 0 .809.34.809.82 0 .475-.334.815-.809.815ZM5.9 6.317C5.96 5.168 6.755 4.4 8.048 4.4c1.218 0 2.091.759 2.091 1.8 0 .736-.36 1.304-1.03 1.707-.56.33-.717.56-.717 1.022v.305l-.1.1H7.47l-.1-.1v-.431c-.005-.646.302-1.104.987-1.514.527-.322.708-.59.708-1.047 0-.536-.416-.91-1.05-.91-.652 0-1.064.374-1.112.998l-.1.092H6l-.1-.105Z"
d="M7.5 11.508 7.468 8H6.25V7h2.401l.03 3.508H9.8v1H7.5Zm-.25-6.202a.83.83 0 0 1 .207-.577c.137-.153.334-.229.59-.229.256 0 .454.076.594.23.14.152.209.345.209.576 0 .228-.07.417-.21.568-.14.15-.337.226-.593.226-.256 0-.453-.075-.59-.226a.81.81 0 0 1-.207-.568ZM8 13A5 5 0 1 0 8 3a5 5 0 0 0 0 10Zm0 1A6 6 0 1 1 8 2a6 6 0 0 1 0 12Z"
fill-rule="evenodd"
/>
</svg>
</span>
Expand Down Expand Up @@ -193,7 +194,8 @@ exports[`AgentStatus component Renders status indicator with the its color and t
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M8 14A6 6 0 1 1 8 2a6 6 0 0 1 0 12Zm0-1A5 5 0 1 0 8 3a5 5 0 0 0 0 10Zm-.186-1.065A.785.785 0 0 1 7 11.12c0-.48.34-.82.814-.82.475 0 .809.34.809.82 0 .475-.334.815-.809.815ZM5.9 6.317C5.96 5.168 6.755 4.4 8.048 4.4c1.218 0 2.091.759 2.091 1.8 0 .736-.36 1.304-1.03 1.707-.56.33-.717.56-.717 1.022v.305l-.1.1H7.47l-.1-.1v-.431c-.005-.646.302-1.104.987-1.514.527-.322.708-.59.708-1.047 0-.536-.416-.91-1.05-.91-.652 0-1.064.374-1.112.998l-.1.092H6l-.1-.105Z"
d="M7.5 11.508 7.468 8H6.25V7h2.401l.03 3.508H9.8v1H7.5Zm-.25-6.202a.83.83 0 0 1 .207-.577c.137-.153.334-.229.59-.229.256 0 .454.076.594.23.14.152.209.345.209.576 0 .228-.07.417-.21.568-.14.15-.337.226-.593.226-.256 0-.453-.075-.59-.226a.81.81 0 0 1-.207-.568ZM8 13A5 5 0 1 0 8 3a5 5 0 0 0 0 10Zm0 1A6 6 0 1 1 8 2a6 6 0 0 1 0 12Z"
fill-rule="evenodd"
/>
</svg>
</span>
Expand Down Expand Up @@ -260,7 +262,8 @@ exports[`AgentStatus component Renders status indicator with the its color and t
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M8 14A6 6 0 1 1 8 2a6 6 0 0 1 0 12Zm0-1A5 5 0 1 0 8 3a5 5 0 0 0 0 10Zm-.186-1.065A.785.785 0 0 1 7 11.12c0-.48.34-.82.814-.82.475 0 .809.34.809.82 0 .475-.334.815-.809.815ZM5.9 6.317C5.96 5.168 6.755 4.4 8.048 4.4c1.218 0 2.091.759 2.091 1.8 0 .736-.36 1.304-1.03 1.707-.56.33-.717.56-.717 1.022v.305l-.1.1H7.47l-.1-.1v-.431c-.005-.646.302-1.104.987-1.514.527-.322.708-.59.708-1.047 0-.536-.416-.91-1.05-.91-.652 0-1.064.374-1.112.998l-.1.092H6l-.1-.105Z"
d="M7.5 11.508 7.468 8H6.25V7h2.401l.03 3.508H9.8v1H7.5Zm-.25-6.202a.83.83 0 0 1 .207-.577c.137-.153.334-.229.59-.229.256 0 .454.076.594.23.14.152.209.345.209.576 0 .228-.07.417-.21.568-.14.15-.337.226-.593.226-.256 0-.453-.075-.59-.226a.81.81 0 0 1-.207-.568ZM8 13A5 5 0 1 0 8 3a5 5 0 0 0 0 10Zm0 1A6 6 0 1 1 8 2a6 6 0 0 1 0 12Z"
fill-rule="evenodd"
/>
</svg>
</span>
Expand Down
2 changes: 1 addition & 1 deletion plugins/main/public/components/agents/agent-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const AgentStatus = ({ status, children = null, style = {}, agent }) => {
anchorClassName='wz-margin-left-10'
aria-label='Description'
size='m'
type='questionInCircle'
type='iInCircle'
color='primary'
content={statusCodeAgent?.STATUS_DESCRIPTION ?? 'Without information'}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
import React, { Component, Fragment } from 'react';
// Eui components
import { EuiFlexItem, EuiButtonEmpty } from '@elastic/eui';
import { EuiFlexItem } from '@elastic/eui';

import { connect } from 'react-redux';

Expand All @@ -20,6 +20,7 @@ import { updateShowAddAgents } from '../../../../../redux/actions/groupsActions'
import GroupsHandler from './utils/groups-handler';
import { ExportConfiguration } from '../../../../../components/agents/export-configuration';
import { ReportingService } from '../../../../../react-services/reporting';
import { WzButtonPermissions } from '../../../../../components/common/permissions/button';

class WzGroupsActionButtonsAgents extends Component {
_isMounted = false;
Expand All @@ -38,13 +39,21 @@ class WzGroupsActionButtonsAgents extends Component {
render() {
// Add new group button
const manageAgentsButton = (
<EuiButtonEmpty
<WzButtonPermissions
buttonType='empty'
permissions={[
{
action: 'group:update_config',
resource: `group:id:${this.props.state.itemDetail.name}`,
},
{ action: 'cluster:status', resource: '*:*:*' },
]}
iconSide='left'
iconType='folderOpen'
onClick={() => this.showManageAgents()}
>
Manage agents
</EuiButtonEmpty>
</WzButtonPermissions>
);

// Export PDF button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ class WzGroupsActionButtonsFiles extends Component {
buttonType='empty'
permissions={[
{
action: 'group:read',
action: 'group:update_config',
resource: `group:id:${this.props.state.itemDetail.name}`,
},
{ action: 'cluster:status', resource: '*:*:*' },
]}
iconSide='left'
iconType='documentEdit'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ class WzGroupAgentsTable extends Component {
align: 'left',
searchable: true,
sortable: true,
render: status => (
render: (status, agent) => (
<AgentStatus
status={status}
agent={agent}
labelProps={{ className: 'hide-agent-status' }}
/>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ export class WzGroupsOverview extends Component {
<WzButtonPermissions
buttonType='icon'
permissions={[
{ action: 'group:read', resource: `group:id:${item.name}` },
{
action: 'group:update_config',
resource: `group:id:${item.name}`,
},
{ action: 'cluster:status', resource: '*:*:*' },
]}
tooltip={{
position: 'top',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ export default class GroupsFilesColumns {
iconType='pencil'
permissions={[
{
action: 'group:read',
action: 'group:update_config',
resource: `group:id:${itemDetail.name}`,
},
{ action: 'cluster:status', resource: '*:*:*' },
]}
tooltip={{
position: 'top',
Expand Down
Loading