/** * Returns a filtered list of directories for a given resource type and path. * * @param ResourceType $resourceType * @param string $path * @param bool $recursive * * @return array */ public function directories(ResourceType $resourceType, $path = '', $recursive = false) { $directoryPath = $this->buildPath($resourceType, $path); $contents = $this->listContents($directoryPath, $recursive); foreach ($contents as &$entry) { $entry['acl'] = $this->acl->getComputedMask($resourceType->getName(), Path::combine($path, $entry['basename'])); } return array_filter($contents, function ($v) { return isset($v['type']) && $v['type'] === 'dir' && !$this->isHiddenFolder($v['basename']) && $v['acl'] & Permission::FOLDER_VIEW; }); }
/** * Returns a filtered list of directories for given resource type and path * * @param ResourceType $resourceType * @param string $path * @param bool $recursive * * @return array */ public function directories(ResourceType $resourceType, $path = '', $recursive = false) { $directoryPath = $this->buildPath($resourceType, $path); $contents = $this->listContents($directoryPath, $recursive); // A temporary fix to disable folders renaming for AWS-S3 adapter $isAws3 = $this->adapter instanceof AwsS3Adapter; foreach ($contents as &$entry) { $entry['acl'] = $this->acl->getComputedMask($resourceType->getName(), Path::combine($path, $entry['basename'])); if ($isAws3) { $entry['acl'] &= ~Permission::FOLDER_RENAME; } } return array_filter($contents, function ($v) { return isset($v['type']) && $v['type'] === 'dir' && !$this->isHiddenFolder($v['basename']) && $v['acl'] & Permission::FOLDER_VIEW; }); }