Skip to content

Commit ac2e427

Browse files
laura-b-ggally47
andauthored
Disabled stream pause/play button for users with missing permissions (#23332)
Co-authored-by: Mohamed OULD HOCINE <[email protected]>
1 parent 6ddbc42 commit ac2e427

File tree

1 file changed

+8
-1
lines changed
  • graylog2-web-interface/src/components/streams/StreamsOverview/cells

1 file changed

+8
-1
lines changed

graylog2-web-interface/src/components/streams/StreamsOverview/cells/StatusCell.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import * as React from 'react';
1818
import styled, { css } from 'styled-components';
1919
import { useCallback } from 'react';
2020

21+
import { isAnyPermitted } from 'util/PermissionsMixin';
22+
import useCurrentUser from 'hooks/useCurrentUser';
2123
import { Icon } from 'components/common';
2224
import { Label } from 'components/bootstrap';
2325
import { StreamsStore } from 'stores/streams/StreamsStore';
@@ -52,7 +54,12 @@ type Props = {
5254
};
5355

5456
const StatusCell = ({ stream }: Props) => {
55-
const disableChange = stream.is_default || !stream.is_editable;
57+
const currentUser = useCurrentUser();
58+
const userHasPermissions = isAnyPermitted(currentUser.permissions, [
59+
`streams:changestate:${stream.id}`,
60+
`streams:edit:${stream.id}`,
61+
]);
62+
const disableChange = stream.is_default || !stream.is_editable || !userHasPermissions;
5663
const description = stream.disabled ? 'Paused' : 'Running';
5764
const title = _title(stream.disabled, disableChange, description);
5865
const sendTelemetry = useSendTelemetry();

0 commit comments

Comments
 (0)