diff --git a/libs/auth-api-lib/src/lib/delegations/utils/filterByScopeCustomScopeRule.ts b/libs/auth-api-lib/src/lib/delegations/utils/filterByScopeCustomScopeRule.ts index c123a4f2ac67..87fbd1d7adff 100644 --- a/libs/auth-api-lib/src/lib/delegations/utils/filterByScopeCustomScopeRule.ts +++ b/libs/auth-api-lib/src/lib/delegations/utils/filterByScopeCustomScopeRule.ts @@ -3,6 +3,7 @@ import { ApiScopeInfo } from '../delegations-incoming.service' export default function filterByCustomScopeRule( scope: ApiScopeInfo, + filterOutForDelegationType: AuthDelegationType[], customScopeRules: { scopeName: string onlyForDelegationType: string[] @@ -14,7 +15,7 @@ export default function filterByCustomScopeRule( return true } - return foundCSR.onlyForDelegationType.includes( - AuthDelegationType.GeneralMandate, + return foundCSR.onlyForDelegationType.some((type) => + filterOutForDelegationType.includes(type as AuthDelegationType), ) }