From cff0e15936fb1f3550b806b81f9e54f77f358175 Mon Sep 17 00:00:00 2001 From: Chris S Date: Wed, 22 Oct 2014 10:05:29 -0500 Subject: [PATCH] Force principalId to be a string. Added a defensive check for undefined to avoid problems when converting to a string. --- common/models/role.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/models/role.js b/common/models/role.js index a86dfcff..e5703b32 100644 --- a/common/models/role.js +++ b/common/models/role.js @@ -354,6 +354,10 @@ module.exports = function(Role) { // Check against the role mappings var principalType = p.type || undefined; var principalId = p.id || undefined; + + if(typeof principalId !== 'string' && typeof principalId !== 'undefined') { + principalId = principalId.toString(); + } // Add the role itself if (principalType === RoleMapping.ROLE && principalId) {