Skip to content

Commit b0f7bee

Browse files
authored
Make getVisibilty use permissions
1 parent c8834a9 commit b0f7bee

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Adapter/Local.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,14 @@ public function getVisibility($path)
343343
$location = $this->applyPathPrefix($path);
344344
clearstatcache(false, $location);
345345
$permissions = octdec(substr(sprintf('%o', fileperms($location)), -4));
346-
$visibility = $permissions & 0044 ? AdapterInterface::VISIBILITY_PUBLIC : AdapterInterface::VISIBILITY_PRIVATE;
347-
348-
return compact('path', 'visibility');
346+
$type = is_dir($location) ? 'dir' : 'file';
347+
348+
foreach ($this->permissionMap[$type] as $visibility => $visibilityPermissions)
349+
if ($visibilityPermissions == $permissions)
350+
return compact('path', 'visibility');
351+
352+
$visibility = substr(sprintf('%o', fileperms($location)), -4);
353+
return compact('path', 'visibility');
349354
}
350355

351356
/**

0 commit comments

Comments
 (0)