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
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue