Skip to content

Commit efdef97

Browse files
authored
[frontend] fix security menu redirections(#14736)
1 parent 89a9493 commit efdef97

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

opencti-platform/opencti-front/src/private/components/nav/LeftBar.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ import useGranted, {
9696
SETTINGS_FILEINDEXING,
9797
SETTINGS_SECURITYACTIVITY,
9898
SETTINGS_SETACCESSES,
99+
SETTINGS_SETAUTH,
99100
SETTINGS_SETCASETEMPLATES,
100101
SETTINGS_SETCUSTOMIZATION,
102+
SETTINGS_SETDISSEMINATION,
101103
SETTINGS_SETKILLCHAINPHASES,
102104
SETTINGS_SETLABELS,
103105
SETTINGS_SETMANAGEXTMHUB,
@@ -248,7 +250,7 @@ const LeftBarComponent = ({ queryRef }) => {
248250
const isGrantedToIngestion = useGranted([MODULES, INGESTION, INGESTION_SETINGESTIONS]);
249251
const isOrganizationAdmin = useGranted([VIRTUAL_ORGANIZATION_ADMIN]);
250252
const isGrantedToCustomization = useGranted([SETTINGS_SETCUSTOMIZATION]);
251-
const isGrantedToSecurity = useGranted([SETTINGS_SETMARKINGS, SETTINGS_SETACCESSES]);
253+
const isGrantedToSecurity = useGranted([SETTINGS_SETMARKINGS, SETTINGS_SETACCESSES, SETTINGS_SETDISSEMINATION, SETTINGS_SETAUTH]);
252254
const isGrantedToAudit = useGranted([SETTINGS_SECURITYACTIVITY]);
253255
const isGrantedToExplore = useGranted([EXPLORE]);
254256
const hasXtmHubAccess = useGranted([SETTINGS_SETMANAGEXTMHUB]);
@@ -747,7 +749,9 @@ const LeftBarComponent = ({ queryRef }) => {
747749
VIRTUAL_ORGANIZATION_ADMIN,
748750
SETTINGS_SETPARAMETERS,
749751
SETTINGS_SETACCESSES,
752+
SETTINGS_SETAUTH,
750753
SETTINGS_SETMARKINGS,
754+
SETTINGS_SETDISSEMINATION,
751755
SETTINGS_SETCUSTOMIZATION,
752756
SETTINGS_SETLABELS,
753757
SETTINGS_SETVOCABULARIES,

opencti-platform/opencti-front/src/private/components/settings/Root.tsx

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,32 @@ const FintelDesigns = lazy(() => import('./fintel_design/FintelDesigns'));
6161
const FintelDesign = lazy(() => import('./fintel_design/FintelDesign'));
6262
const Experience = lazy(() => import('./Experience'));
6363

64-
const Root = () => {
64+
const AccessesRedirect = () => {
6565
const adminOrga = isOnlyOrganizationAdmin();
66+
const hasSetAccesses = useGranted([SETTINGS_SETACCESSES]);
67+
const hasVirtualOrgAdmin = useGranted([VIRTUAL_ORGANIZATION_ADMIN]);
68+
const hasSetMarkings = useGranted([SETTINGS_SETMARKINGS]);
69+
const hasSetDissemination = useGranted([SETTINGS_SETDISSEMINATION]);
70+
const hasSetAuth = useGranted([SETTINGS_SETAUTH]);
71+
if (hasSetAccesses) {
72+
return <Navigate to="/dashboard/settings/accesses/roles" />;
73+
}
74+
if (hasVirtualOrgAdmin) {
75+
return <Navigate to={adminOrga ? '/dashboard/settings/accesses/organizations' : '/dashboard/settings/accesses/roles'} />;
76+
}
77+
if (hasSetAuth) {
78+
return <Navigate to="/dashboard/settings/accesses/authentications" />;
79+
}
80+
if (hasSetMarkings) {
81+
return <Navigate to="/dashboard/settings/accesses/marking" />;
82+
}
83+
if (hasSetDissemination) {
84+
return <Navigate to="/dashboard/settings/accesses/dissemination_list" />;
85+
}
86+
return <Navigate to="/dashboard/settings" />;
87+
};
6688

89+
const Root = () => {
6790
const isGrantedToLabels = useGranted([SETTINGS_SETLABELS]);
6891
const isGrantedToVocabularies = useGranted([SETTINGS_SETVOCABULARIES]);
6992
const isGrantedToKillChainPhases = useGranted([SETTINGS_SETKILLCHAINPHASES]);
@@ -124,10 +147,10 @@ const Root = () => {
124147
path="/accesses"
125148
element={(
126149
<Security
127-
needs={[SETTINGS_SETACCESSES, VIRTUAL_ORGANIZATION_ADMIN]}
150+
needs={[SETTINGS_SETACCESSES, SETTINGS_SETMARKINGS, SETTINGS_SETDISSEMINATION, SETTINGS_SETAUTH, VIRTUAL_ORGANIZATION_ADMIN]}
128151
placeholder={<Navigate to={urlWithCapabilities()} />}
129152
>
130-
<Navigate to={adminOrga ? '/dashboard/settings/accesses/organizations' : '/dashboard/settings/accesses/roles'} />
153+
<AccessesRedirect />
131154
</Security>
132155
)}
133156
/>

0 commit comments

Comments
 (0)