Force principalId to be a string in Role.getRoles Fix #676

Added a defensive check for undefined to avoid problems
when converting to a string.