File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -96,10 +96,18 @@ export function getUserVOs(authData: AuthData): string[] {
9696}
9797
9898export function getAllowedVOs ( systemConfig : { config : SystemConfig } | null , authData : AuthData ) : string [ ] {
99- if ( ! systemConfig || ! systemConfig . config ) return [ ] ;
99+ if ( ! systemConfig || ! systemConfig . config || ! systemConfig . config . oidc_groups || systemConfig . config . oidc_groups . length === 0 ) return [ ] ;
100+ // If user is oscar, return all allowed VOs from system config
101+ if ( authData . user === "oscar" ) return systemConfig . config . oidc_groups ;
102+ // Get user's VOs
100103 const userVOs = getUserVOs ( authData ) ;
101- return systemConfig . config . oidc_groups . filter ( ( vo ) => authData . user === "oscar" || userVOs . includes ( vo ) ) ;
104+ // If user has no VOs, return all allowed VOs from system config
105+ if ( userVOs . length === 0 ) return systemConfig . config . oidc_groups ;
106+ // Filter allowed VOs based on user's VOs
107+ const filteredVOs = systemConfig . config . oidc_groups . filter ( ( vo ) => userVOs . includes ( vo ) ) ;
108+ return filteredVOs ;
102109}
110+
103111function sleep ( ms : number ) {
104112 return new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
105113}
You can’t perform that action at this time.
0 commit comments