Merge pull request #680 from arlaneenalra/feature/fix-676

Force principalId to be a string in Role.getRoles Fix #676
This commit is contained in:
Raymond Feng 2014-10-23 08:55:17 -07:00
commit 03b3c3cda4
1 changed files with 5 additions and 1 deletions

View File

@ -353,7 +353,11 @@ module.exports = function(Role) {
context.principals.forEach(function(p) {
// Check against the role mappings
var principalType = p.type || undefined;
var principalId = p.id || undefined;
var principalId = p.id == null ? undefined : p.id;
if(typeof principalId !== 'string' && principalId != null) {
principalId = principalId.toString();
}
// Add the role itself
if (principalType === RoleMapping.ROLE && principalId) {