Force principalId to be a string.
Added a defensive check for undefined to avoid problems when converting to a string.
This commit is contained in:
parent
c65b80432b
commit
cff0e15936
|
@ -355,6 +355,10 @@ module.exports = function(Role) {
|
|||
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) {
|
||||
addRole(principalId);
|
||||
|
|
Loading…
Reference in New Issue