@@ -42,6 +42,7 @@ ACL.prototype.readACL = function(pathAcl, pathUri, callback) {
4242
4343 ldp . readFile ( pathAcl , function ( err , aclData ) {
4444 if ( err ) {
45+ debug ( "Error parsing ACL policy: " + err . message ) ;
4546 return callback ( err ) ;
4647 }
4748 try {
@@ -91,7 +92,7 @@ ACL.prototype.findACLinPath = function (mode, pathAcl, userId, aclGraph, accessT
9192 message : "Access to " + pathUri + " requires authorization"
9293 } ) ;
9394 }
94- // No ACL found, access is denied
95+ // No ACL statement found, access is denied
9596 debug ( mode + " access denied for: " + userId ) ;
9697 return callback ( {
9798 status : 403 ,
@@ -122,15 +123,15 @@ ACL.prototype.findACL = function(mode, address, userId, callback) {
122123 async . whilst (
123124 // Check if we have gone through all the `/` in relativePath
124125 function ( ) {
125- return i < depth . length ;
126+ console . log ( i ) ;
127+ return i ++ < depth . length ;
126128 } ,
127129 function ( done ) {
128-
129130 var pathAcl = S ( filepath ) . endsWith ( ldp . suffixAcl ) ?
130131 filepath : filepath + ldp . suffixAcl ;
131132 var pathUri = file . filenameToBaseUri ( filepath , acl . uri , ldp . root ) ;
132133 var relativePath = path . relative ( ldp . root , filepath ) ;
133- debug ( 'relativePath = ' + relativePath ) ;
134+ // debug('relativePath = ' + relativePath);
134135
135136 debug ( "Checking " + accessType + "<" + mode + "> to " + pathUri + " for WebID: " + userId ) ;
136137 debug ( "Looking for policies in " + pathAcl ) ;
@@ -144,19 +145,21 @@ ACL.prototype.findACL = function(mode, address, userId, callback) {
144145 acl . findACLinPath ( mode , pathAcl , userId , aclGraph , accessType , pathUri , function ( err , found ) {
145146 // Error occurred (e.g. file not found)
146147 if ( err ) {
147- debug ( 'FindACLInPath failed in ' + pathAcl + ' with error ' + err ) ;
148+ // debug('FindACLInPath failed in ' + pathAcl + ' with error ' + err.message );
148149 return done ( err ) ;
149150 }
150151
151152 // ACL rule that allow the userId to read is found
152153 if ( found ) {
154+ // debug('FindACLinPath not found');
153155 return done ( true ) ;
154156 }
155157
156158 // Set the new path for the next loop iteration
157159 accessType = "defaultForNew" ;
158160 if ( relativePath . length === 0 && i !== 0 ) {
159- return done ( false ) ;
161+ // TODO handle this error
162+ return done ( true ) ;
160163 } else if ( path . dirname ( path . dirname ( relativePath ) ) === '.' ) {
161164 filepath = ldp . root ;
162165 } else {
@@ -267,7 +270,7 @@ ACL.prototype.allow = function(mode, address, callback) {
267270 return callback ( err ) ;
268271 }
269272 acl . findACL ( mode , address , userId , function ( err , res ) {
270- callback ( err , res ) ;
273+ return callback ( err , res ) ;
271274 } ) ;
272275 } ) ;
273276} ;
@@ -514,8 +517,6 @@ exports.allowAppendThenWriteHandler = function(req, res, next) {
514517 return next ( ) ;
515518 }
516519 // Append failed, maybe user can write
517-
518- var allowWriteValue = allow ( "Write" , req ) ;
519520 allow ( "Write" , req , function ( err , allowed ) {
520521 if ( ! err && allowed === true ) {
521522 return next ( ) ;
0 commit comments