Add more check on principalId

This commit is contained in:
haio 2014-04-29 09:34:48 +08:00
parent aa63d7bf4b
commit f44d737e7e
1 changed files with 3 additions and 1 deletions

View File

@ -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;