export function filterOutUnusableScope()

in src/smartScopeHelper.ts [150:174]


export function filterOutUnusableScope(
    scopes: string[],
    scopeRule: ScopeRule,
    reqOperation: TypeOperation | SystemOperation,
    isUserScopeAllowedForSystemExport: boolean,
    reqResourceType?: string,
    bulkDataAuth?: BulkDataAuth,
    patientContext?: string,
    fhirUser?: string,
): string[] {
    return scopes.filter(
        (scope: string) =>
            ((patientContext && scope.startsWith('patient/')) ||
                (fhirUser && scope.startsWith('user/')) ||
                scope.startsWith('system/')) &&
            isScopeSufficient(
                scope,
                scopeRule,
                reqOperation,
                isUserScopeAllowedForSystemExport,
                reqResourceType,
                bulkDataAuth,
            ),
    );
}