From f44d737e7edf4765a1f099f4ad154b21b4eef437 Mon Sep 17 00:00:00 2001 From: haio Date: Tue, 29 Apr 2014 09:34:48 +0800 Subject: [PATCH] Add more check on principalId --- lib/models/acl.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/models/acl.js b/lib/models/acl.js index 3d2343d4..3663273e 100644 --- a/lib/models/acl.js +++ b/lib/models/acl.js @@ -296,7 +296,9 @@ ACL.getStaticACLs = function getStaticACLs(model, property) { ACL.checkPermission = function checkPermission(principalType, principalId, model, property, accessType, callback) { - principalId = principalId.toString(); + if(principalId !== null && principalId !== undefined && (typeof principalId !== 'string') ) { + principlaId = principalId.toString(); + } property = property || ACL.ALL; var propertyQuery = (property === ACL.ALL) ? undefined : {inq: [property, ACL.ALL]}; accessType = accessType || ACL.ALL;