Skip to content

Commit 589ace3

Browse files
committed
[backend/frontend] Enhance opinions display, ensure permissions are correct (#8227, #8485, #8842)
1 parent 93b691b commit 589ace3

File tree

20 files changed

+288
-106
lines changed

20 files changed

+288
-106
lines changed

opencti-platform/opencti-front/lang/front/de.json

+2
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@
780780
"Do you want to delete this notifier?": "Möchten Sie diesen Melder löschen?",
781781
"Do you want to delete this observable?": "Möchten Sie diesen Beobachtungswert löschen?",
782782
"Do you want to delete this observed data?": "Möchten Sie diese beobachteten Daten löschen?",
783+
"Do you want to delete this opinion?": "Möchten Sie diese Stellungnahme löschen?",
783784
"Do you want to delete this opinions?": "Möchten Sie diese Meinung löschen?",
784785
"Do you want to delete this organization?": "Möchten Sie diese Organisation löschen?",
785786
"Do you want to delete this playbook?": "Möchten Sie dieses Spielbuch löschen?",
@@ -1577,6 +1578,7 @@
15771578
"List": "Liste",
15781579
"List (distribution)": "Liste (Verteilung)",
15791580
"List of entities": "Liste der Entitäten",
1581+
"List of opinions": "Liste der Stellungnahmen",
15801582
"List separator": "Listentrennzeichen",
15811583
"List settings": "Listeneinstellungen",
15821584
"Listen queue": "Warteschlange abhören",

opencti-platform/opencti-front/lang/front/en.json

+2
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@
780780
"Do you want to delete this notifier?": "Do you want to delete this notifier?",
781781
"Do you want to delete this observable?": "Do you want to delete this observable?",
782782
"Do you want to delete this observed data?": "Do you want to delete this observed data?",
783+
"Do you want to delete this opinion?": "Do you want to delete this opinion?",
783784
"Do you want to delete this opinions?": "Do you want to delete this opinions?",
784785
"Do you want to delete this organization?": "Do you want to delete this organization?",
785786
"Do you want to delete this playbook?": "Do you want to delete this playbook?",
@@ -1577,6 +1578,7 @@
15771578
"List": "List",
15781579
"List (distribution)": "List (distribution)",
15791580
"List of entities": "List of entities",
1581+
"List of opinions": "List of opinions",
15801582
"List separator": "List separator",
15811583
"List settings": "List settings",
15821584
"Listen queue": "Listen queue",

opencti-platform/opencti-front/lang/front/es.json

+2
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@
780780
"Do you want to delete this notifier?": "¿Desea eliminar este notificador?",
781781
"Do you want to delete this observable?": "¿Quieres borrar este observable?",
782782
"Do you want to delete this observed data?": "¿Quieres borrar este conjunto de datos observados?",
783+
"Do you want to delete this opinion?": "¿Quieres borrar esta opinión?",
783784
"Do you want to delete this opinions?": "¿Quieres borrar esta opinión?",
784785
"Do you want to delete this organization?": "¿Quieres borrar esta organización?",
785786
"Do you want to delete this playbook?": "¿Quiere borrar este libro de jugadas?",
@@ -1577,6 +1578,7 @@
15771578
"List": "Lista",
15781579
"List (distribution)": "Lista (distribución)",
15791580
"List of entities": "Lista de entidades",
1581+
"List of opinions": "Lista de opiniones",
15801582
"List separator": "Separador de lista",
15811583
"List settings": "Configuración de la lista",
15821584
"Listen queue": "Cola de escucha",

opencti-platform/opencti-front/lang/front/fr.json

+2
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@
780780
"Do you want to delete this notifier?": "Voulez-vous supprimer ce notificateur ?",
781781
"Do you want to delete this observable?": "Souhaitez-vous supprimer cet observable ?",
782782
"Do you want to delete this observed data?": "Souhaitez-vous supprimer cette données observée ?",
783+
"Do you want to delete this opinion?": "Souhaitez-vous supprimer cet avis ?",
783784
"Do you want to delete this opinions?": "Voulez-vous supprimer cette opinion ?",
784785
"Do you want to delete this organization?": "Souhaitez-vous supprimer cette organisation ?",
785786
"Do you want to delete this playbook?": "Voulez-vous supprimer ce playbook ?",
@@ -1577,6 +1578,7 @@
15771578
"List": "Liste",
15781579
"List (distribution)": "Liste (distribution)",
15791580
"List of entities": "Liste d'entités",
1581+
"List of opinions": "Liste des avis",
15801582
"List separator": "Séparateur de liste",
15811583
"List settings": "Paramètres de liste",
15821584
"Listen queue": "File d'attente d'écoute",

opencti-platform/opencti-front/lang/front/ja.json

+2
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@
780780
"Do you want to delete this notifier?": "このノーティファイアを削除しますか?",
781781
"Do you want to delete this observable?": "この観測結果を削除しますか?",
782782
"Do you want to delete this observed data?": "この観測データを削除しますか?",
783+
"Do you want to delete this opinion?": "この意見を削除しますか?",
783784
"Do you want to delete this opinions?": "この意見を削除しますか?",
784785
"Do you want to delete this organization?": "この組織を削除しますか?",
785786
"Do you want to delete this playbook?": "このプレイブックを削除しますか?",
@@ -1577,6 +1578,7 @@
15771578
"List": "リスト",
15781579
"List (distribution)": "リスト(配布)",
15791580
"List of entities": "エンティティ一覧",
1581+
"List of opinions": "意見一覧",
15801582
"List separator": "リストのセパレータ",
15811583
"List settings": "リスト設定",
15821584
"Listen queue": "キューを聞く",

opencti-platform/opencti-front/lang/front/ko.json

+2
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@
780780
"Do you want to delete this notifier?": "이 알림을 삭제하시겠습니까?",
781781
"Do you want to delete this observable?": "이 관찰 가능 항목을 삭제하시겠습니까?",
782782
"Do you want to delete this observed data?": "이 관찰된 데이터를 삭제하시겠습니까?",
783+
"Do you want to delete this opinion?": "이 의견을 삭제하시겠습니까?",
783784
"Do you want to delete this opinions?": "이 의견을 삭제하시겠습니까?",
784785
"Do you want to delete this organization?": "이 조직을 삭제하시겠습니까?",
785786
"Do you want to delete this playbook?": "이 플레이북을 삭제하시겠습니까?",
@@ -1577,6 +1578,7 @@
15771578
"List": "목록",
15781579
"List (distribution)": "목록 (분포)",
15791580
"List of entities": "엔터티 목록",
1581+
"List of opinions": "의견 목록",
15801582
"List separator": "목록 구분 기호",
15811583
"List settings": "목록 설정",
15821584
"Listen queue": "대기열 듣기",

opencti-platform/opencti-front/lang/front/zh.json

+2
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@
780780
"Do you want to delete this notifier?": "您想删除此通知器吗?",
781781
"Do you want to delete this observable?": "是否要删除此可观测数据?",
782782
"Do you want to delete this observed data?": "是否要删除此观测数据?",
783+
"Do you want to delete this opinion?": "您想删除此意见吗?",
783784
"Do you want to delete this opinions?": "您想删除该意见吗?",
784785
"Do you want to delete this organization?": "是否要删除此组织?",
785786
"Do you want to delete this playbook?": "您要删除此剧本吗?",
@@ -1577,6 +1578,7 @@
15771578
"List": "列表",
15781579
"List (distribution)": "列表(分布)",
15791580
"List of entities": "实体列表",
1581+
"List of opinions": "意见列表",
15801582
"List separator": "列表分隔符",
15811583
"List settings": "列表设置",
15821584
"Listen queue": "监听队列",

opencti-platform/opencti-front/src/components/dashboard/WidgetRadar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const WidgetRadar = ({
3636
const labels = buildWidgetLabelsOption(data, groupBy);
3737
return (
3838
<Chart
39-
options={radarChartOptions(theme, labels, simpleNumberFormat, [], true, false) as ApexOptions}
39+
options={radarChartOptions(theme, labels, simpleNumberFormat, [], true) as ApexOptions}
4040
series={chartData}
4141
type="radar"
4242
width="100%"

opencti-platform/opencti-front/src/private/components/analyses/opinions/AddOpinionsLines.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ class AddOpinionsLinesContainer extends Component {
125125
return (
126126
<ListItem
127127
key={opinion.id}
128-
classes={{ root: classes.menuItem }}
129128
divider={true}
130129
button={true}
131130
onClick={this.toggleOpinion.bind(this, opinion)}

opencti-platform/opencti-front/src/private/components/analyses/opinions/Opinion.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const OpinionComponent = ({ opinion, enableReferences }) => {
5252
<OpinionDetails opinion={opinion} />
5353
</Grid>
5454
<Grid item xs={6}>
55-
<StixDomainObjectOverview stixDomainObject={opinion} />
55+
<StixDomainObjectOverview stixDomainObject={opinion} displayOpinions={false} />
5656
</Grid>
5757
<Grid item xs={12}>
5858
<ContainerStixObjectsOrStixRelationships

opencti-platform/opencti-front/src/private/components/analyses/opinions/OpinionPopover.jsx

+47-35
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,18 @@ import Dialog from '@mui/material/Dialog';
77
import DialogActions from '@mui/material/DialogActions';
88
import DialogContent from '@mui/material/DialogContent';
99
import DialogContentText from '@mui/material/DialogContentText';
10-
import Slide from '@mui/material/Slide';
1110
import MoreVert from '@mui/icons-material/MoreVert';
1211
import { graphql } from 'react-relay';
1312
import ToggleButton from '@mui/material/ToggleButton';
13+
import IconButton from '@mui/material/IconButton';
1414
import { useFormatter } from '../../../../components/i18n';
1515
import { QueryRenderer } from '../../../../relay/environment';
1616
import { opinionEditionQuery } from './OpinionEdition';
1717
import { CollaborativeSecurity } from '../../../../utils/Security';
1818
import { KNOWLEDGE_KNUPDATE_KNDELETE } from '../../../../utils/hooks/useGranted';
1919
import OpinionEditionContainer from './OpinionEditionContainer';
2020
import useApiMutation from '../../../../utils/hooks/useApiMutation';
21-
22-
const Transition = React.forwardRef((props, ref) => (
23-
<Slide direction="up" ref={ref} {...props} />
24-
));
25-
Transition.displayName = 'TransitionSlide';
21+
import Transition from '../../../../components/Transition';
2622

2723
const OpinionPopoverDeletionMutation = graphql`
2824
mutation OpinionPopoverDeletionMutation($id: ID!) {
@@ -32,7 +28,7 @@ const OpinionPopoverDeletionMutation = graphql`
3228
}
3329
`;
3430

35-
const OpinionPopover = (data) => {
31+
const OpinionPopover = ({ opinion, variant = 'overview' }) => {
3632
const navigate = useNavigate();
3733
const { t_i18n } = useFormatter();
3834
const [anchorEl, setAnchorEl] = useState(null);
@@ -50,11 +46,13 @@ const OpinionPopover = (data) => {
5046
const submitDelete = () => {
5147
setDeleting(true);
5248
commit({
53-
variables: { id: data.id },
49+
variables: { id: opinion.id },
5450
onCompleted: () => {
5551
setDeleting(false);
5652
handleClose();
57-
navigate('/dashboard/analyses/opinions');
53+
if (variant !== 'inList') {
54+
navigate('/dashboard/analyses/opinions');
55+
}
5856
},
5957
});
6058
};
@@ -65,17 +63,29 @@ const OpinionPopover = (data) => {
6563
const handleCloseEdit = () => setDisplayEdit(false);
6664
return (
6765
<>
68-
<ToggleButton
69-
value="popover"
70-
size="small"
71-
onClick={handleOpen}
72-
>
73-
<MoreVert fontSize="small" color="primary" />
74-
</ToggleButton>
66+
{variant === 'inList' ? (
67+
<IconButton
68+
onClick={handleOpen}
69+
aria-haspopup="true"
70+
size="large"
71+
style={{ marginTop: 3 }}
72+
color="primary"
73+
>
74+
<MoreVert />
75+
</IconButton>
76+
) : (
77+
<ToggleButton
78+
value="popover"
79+
size="small"
80+
onClick={handleOpen}
81+
>
82+
<MoreVert fontSize="small" color="primary" />
83+
</ToggleButton>
84+
)}
7585
<Menu anchorEl={anchorEl} open={Boolean(anchorEl)} onClose={handleClose}>
76-
<MenuItem onClick={handleOpenEdit}>{t_i18n('Update')}</MenuItem>
86+
{variant !== 'inList' && <MenuItem onClick={handleOpenEdit}>{t_i18n('Update')}</MenuItem>}
7787
<CollaborativeSecurity
78-
data={data.opinion}
88+
data={opinion}
7989
needs={[KNOWLEDGE_KNUPDATE_KNDELETE]}
8090
>
8191
<MenuItem onClick={handleOpenDelete}>{t_i18n('Delete')}</MenuItem>
@@ -89,7 +99,7 @@ const OpinionPopover = (data) => {
8999
>
90100
<DialogContent>
91101
<DialogContentText>
92-
{t_i18n('Do you want to delete this opinions?')}
102+
{t_i18n('Do you want to delete this opinion?')}
93103
</DialogContentText>
94104
</DialogContent>
95105
<DialogActions>
@@ -101,22 +111,24 @@ const OpinionPopover = (data) => {
101111
</Button>
102112
</DialogActions>
103113
</Dialog>
104-
<QueryRenderer
105-
query={opinionEditionQuery}
106-
variables={{ id: data.id }}
107-
render={({ props }) => {
108-
if (props) {
109-
return (
110-
<OpinionEditionContainer
111-
opinion={props.opinion}
112-
handleClose={handleCloseEdit}
113-
open={displayEdit}
114-
/>
115-
);
116-
}
117-
return <div />;
118-
}}
119-
/>
114+
{variant !== 'inList' && (
115+
<QueryRenderer
116+
query={opinionEditionQuery}
117+
variables={{ id: opinion.id }}
118+
render={({ props }) => {
119+
if (props) {
120+
return (
121+
<OpinionEditionContainer
122+
opinion={props.opinion}
123+
handleClose={handleCloseEdit}
124+
open={displayEdit}
125+
/>
126+
);
127+
}
128+
return <div />;
129+
}}
130+
/>
131+
)}
120132
</>
121133
);
122134
};

0 commit comments

Comments
 (0)