AW-4673 Fix ERROR Error: Uncaught (in promise): TypeError: ownedRoleClaims.findIndex is not a function
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Peter (extern) 2023-02-27 09:43:39 +01:00
parent ed7f7923ca
commit 9ef6c4d308

View File

@ -50,7 +50,12 @@ export class AuthGuard implements CanActivate, CanLoad, CanActivateChild {
if (!ownedClaims) { resolve(false); }
const ownedRoleClaims: string[] = ownedClaims['role'];
if (!ownedRoleClaims) { resolve(false); }
if (ownedRoleClaims.findIndex(r => r === requiredRoleClaim) <= -1) { resolve(false); }
if (Array.isArray(ownedRoleClaims)) {
if (ownedRoleClaims.findIndex(r => r === requiredRoleClaim) <= -1) { resolve(false); }
}
else {
if (ownedRoleClaims !== requiredRoleClaim) { resolve(false); }
}
resolve(true);
}
});