-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68f32f0
commit 6bfd414
Showing
5 changed files
with
61 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
libs/auth-api-lib/src/lib/delegations/utils/filterByScopeCustomScopeRule.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { AuthDelegationType } from '@island.is/shared/types' | ||
import { ApiScopeInfo } from '../delegations-incoming.service' | ||
|
||
export default function filterByCustomScopeRule( | ||
scope: ApiScopeInfo, | ||
customScopeRules: { | ||
scopeName: string | ||
onlyForDelegationType: string[] | ||
}[], | ||
): boolean { | ||
const foundCSR = customScopeRules.find((csr) => csr.scopeName === scope.name) | ||
|
||
if (!foundCSR) { | ||
return true | ||
} | ||
|
||
return foundCSR.onlyForDelegationType.includes( | ||
AuthDelegationType.GeneralMandate, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters