@@ -53,10 +53,10 @@ public function isAllowed($request, $webId, $origin=false, $allowedOrigins=[]) {
53
53
$ uri = $ request ->getUri ();
54
54
$ parentUri = $ this ->getParentUri ($ uri );
55
55
56
- // @FIXME: $origin can be anything at this point, null, string, array, bool
57
- // This causes trouble downstream where an unchecked `parse_url($origin)['host'];` occurs
56
+ // @FIXME: $origin can be anything at this point, null, string, array, bool
57
+ // This causes trouble downstream where an unchecked `parse_url($origin)['host'];` occurs
58
58
59
- foreach ($ requestedGrants as $ requestedGrant ) {
59
+ foreach ($ requestedGrants as $ requestedGrant ) {
60
60
switch ($ requestedGrant ['type ' ]) {
61
61
case "resource " :
62
62
if ($ this ->isPublicGranted ($ requestedGrant ['grants ' ], $ uri )) {
@@ -141,9 +141,9 @@ private function isOriginGranted($requestedGrants, $uri, $origin, $allowedOrigin
141
141
) {
142
142
return true ;
143
143
}
144
- //error_log("REQUESTED GRANT: " . join(" or ", $requestedGrants) . " on $uri");
144
+ // error_log("REQUESTED GRANT: " . join(" or ", $requestedGrants) . " on $uri");
145
145
$ grants = $ this ->getOriginGrants ($ uri , $ origin );
146
- //error_log("GRANTED GRANTS for origin $origin: " . json_encode($grants));
146
+ // error_log("GRANTED GRANTS for origin $origin: " . json_encode($grants));
147
147
return $ this ->checkGrants ($ requestedGrants , $ uri , $ grants );
148
148
}
149
149
@@ -307,14 +307,13 @@ private function getAclPath($path) {
307
307
308
308
foreach ($ aclOptions as $ aclPath ) {
309
309
if (
310
- $ this ->filesystem ->has ($ aclPath )
311
- && $ this ->filesystem ->read ($ aclPath ) !== false
310
+ $ this ->filesystem ->has ($ aclPath ) && $ this ->filesystem ->read ($ aclPath ) !== false
312
311
) {
313
312
return $ aclPath ;
314
313
}
315
314
}
316
315
317
- //error_log("Seeking .acl from $path");
316
+ // error_log("Seeking .acl from $path");
318
317
// see: https://github.com/solid/web-access-control-spec#acl-inheritance-algorithm
319
318
// check for acl:default predicate, if not found, continue searching up the directory tree
320
319
return $ this ->getParentAcl ($ path );
@@ -323,10 +322,10 @@ private function normalizePath($path) {
323
322
return preg_replace ("|//| " , "/ " , $ path );
324
323
}
325
324
private function getParentAcl ($ path ) {
326
- //error_log("GET PARENT ACL $path");
327
- if ($ this ->filesystem ->has ($ path .'/.acl ' )) {
328
- //error_log("CHECKING ACL FILE ON $path/.acl");
329
- return $ path . "/.acl " ;
325
+ // error_log("GET PARENT ACL $path");
326
+ if ($ this ->filesystem ->has ($ this -> normalizePath ( $ path .'/.acl ' ) )) {
327
+ // error_log("CHECKING ACL FILE ON $path/.acl");
328
+ return $ this -> normalizePath ( $ path . "/.acl " ) ;
330
329
}
331
330
$ parent = dirname ($ path );
332
331
if ($ parent == $ path ) {
0 commit comments