Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ import useGranted, {
SETTINGS_FILEINDEXING,
SETTINGS_SECURITYACTIVITY,
SETTINGS_SETACCESSES,
SETTINGS_SETAUTH,
SETTINGS_SETCASETEMPLATES,
SETTINGS_SETCUSTOMIZATION,
SETTINGS_SETDISSEMINATION,
SETTINGS_SETKILLCHAINPHASES,
SETTINGS_SETLABELS,
SETTINGS_SETMANAGEXTMHUB,
Expand Down Expand Up @@ -248,7 +250,7 @@ const LeftBarComponent = ({ queryRef }) => {
const isGrantedToIngestion = useGranted([MODULES, INGESTION, INGESTION_SETINGESTIONS]);
const isOrganizationAdmin = useGranted([VIRTUAL_ORGANIZATION_ADMIN]);
const isGrantedToCustomization = useGranted([SETTINGS_SETCUSTOMIZATION]);
const isGrantedToSecurity = useGranted([SETTINGS_SETMARKINGS, SETTINGS_SETACCESSES]);
const isGrantedToSecurity = useGranted([SETTINGS_SETMARKINGS, SETTINGS_SETACCESSES, SETTINGS_SETDISSEMINATION, SETTINGS_SETAUTH]);
const isGrantedToAudit = useGranted([SETTINGS_SECURITYACTIVITY]);
const isGrantedToExplore = useGranted([EXPLORE]);
const hasXtmHubAccess = useGranted([SETTINGS_SETMANAGEXTMHUB]);
Expand Down Expand Up @@ -747,7 +749,9 @@ const LeftBarComponent = ({ queryRef }) => {
VIRTUAL_ORGANIZATION_ADMIN,
SETTINGS_SETPARAMETERS,
SETTINGS_SETACCESSES,
SETTINGS_SETAUTH,
SETTINGS_SETMARKINGS,
SETTINGS_SETDISSEMINATION,
SETTINGS_SETCUSTOMIZATION,
SETTINGS_SETLABELS,
SETTINGS_SETVOCABULARIES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,32 @@ const FintelDesigns = lazy(() => import('./fintel_design/FintelDesigns'));
const FintelDesign = lazy(() => import('./fintel_design/FintelDesign'));
const Experience = lazy(() => import('./Experience'));

const Root = () => {
const AccessesRedirect = () => {
const adminOrga = isOnlyOrganizationAdmin();
const hasSetAccesses = useGranted([SETTINGS_SETACCESSES]);
const hasVirtualOrgAdmin = useGranted([VIRTUAL_ORGANIZATION_ADMIN]);
const hasSetMarkings = useGranted([SETTINGS_SETMARKINGS]);
const hasSetDissemination = useGranted([SETTINGS_SETDISSEMINATION]);
const hasSetAuth = useGranted([SETTINGS_SETAUTH]);
if (hasSetAccesses) {
return <Navigate to="/dashboard/settings/accesses/roles" />;
}
if (hasVirtualOrgAdmin) {
return <Navigate to={adminOrga ? '/dashboard/settings/accesses/organizations' : '/dashboard/settings/accesses/roles'} />;
}
if (hasSetAuth) {
return <Navigate to="/dashboard/settings/accesses/authentications" />;
}
if (hasSetMarkings) {
return <Navigate to="/dashboard/settings/accesses/marking" />;
}
if (hasSetDissemination) {
return <Navigate to="/dashboard/settings/accesses/dissemination_list" />;
}
return <Navigate to="/dashboard/settings" />;
};

const Root = () => {
const isGrantedToLabels = useGranted([SETTINGS_SETLABELS]);
const isGrantedToVocabularies = useGranted([SETTINGS_SETVOCABULARIES]);
const isGrantedToKillChainPhases = useGranted([SETTINGS_SETKILLCHAINPHASES]);
Expand Down Expand Up @@ -124,10 +147,10 @@ const Root = () => {
path="/accesses"
element={(
<Security
needs={[SETTINGS_SETACCESSES, VIRTUAL_ORGANIZATION_ADMIN]}
needs={[SETTINGS_SETACCESSES, SETTINGS_SETMARKINGS, SETTINGS_SETDISSEMINATION, SETTINGS_SETAUTH, VIRTUAL_ORGANIZATION_ADMIN]}
placeholder={<Navigate to={urlWithCapabilities()} />}
>
<Navigate to={adminOrga ? '/dashboard/settings/accesses/organizations' : '/dashboard/settings/accesses/roles'} />
<AccessesRedirect />
</Security>
)}
/>
Expand Down
Loading