@@ -61,9 +61,32 @@ const FintelDesigns = lazy(() => import('./fintel_design/FintelDesigns'));
6161const FintelDesign = lazy ( ( ) => import ( './fintel_design/FintelDesign' ) ) ;
6262const 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