Skip to content
Snippets Groups Projects
Commit 42df1a27 authored by Claudiu Cristea's avatar Claudiu Cristea
Browse files

Issue #3522020 by claudiu.cristea: Leftovers from #3520424

parent e5688372
No related branches found
No related tags found
1 merge request!2Leftovers
Pipeline #485989 passed
......@@ -20,7 +20,7 @@ Path
## How does it work?
To be able to move a file from public to private filesystem and vice versa, the module should be able to determine which is the source entity for a certain file and determine its visibility for anonymous users. But checking the source entity visibility is not enough; it should follow the path from the source entity to the file destination and check the visibility of each traversable entity on the way. This is achieved by the `Drupal\file_visibility\FileVisibility` service. The service interrogates all `FileVisibility` plugins and collects paths from source entities to the file. If at least one path has all entities publicly visible, then we consider that the file is in use and should be publicly accessible under its original public file system. If there's no path that can be traversed by an anonymous user, the file is moved under the private file system.
To be able to move a file from public to private filesystem and vice versa, the module should be able to determine which are the source entities for a certain file and determine their visibility for anonymous users. But checking the source entity visibility is not enough; it should follow the path from the source entity to the file destination and check the visibility of each traversable entity on the way. This is achieved by the `Drupal\file_visibility\FileVisibility` service. The service interrogates all `FileVisibility` plugins and collects paths from source entities to the file. If at least one path has all entities publicly visible, then we consider that the file is in use and should be publicly accessible under its original public file system. If there's no path that can be traversed by an anonymous user, the file is moved under the private file system.
The main module, `file_visibility`, offers the `FileVisibility` plugin type. This plugin type knows how to determine the relation between a file and its source entity, including all paths from source to the file. By default, the module only provides the plugin discovery attributes, the manager and the interface, but no plugin class. But there is the [file_visibility_track_usage](modules/file_visibility_track_usage) submodule that ships a plugin which computes such relation by extracting data from the [Track Usage](https://www.drupal.org/project/track_usage) module.
......
......@@ -20,7 +20,7 @@
"require": {
"php": ">=8.1",
"ext-pdo": "*",
"drupal/track_usage": "dev-3520538-optimizations as 1.0.0"
"drupal/track_usage": "^1.0"
},
"require-dev": {
"drupal/paragraphs": "^1.18",
......@@ -33,11 +33,5 @@
"php-http/discovery": true,
"tbachert/spi": true
}
},
"repositories": [
{
"type": "vcs",
"url": "https://git.drupalcode.org/issue/track_usage-3520538.git"
}
]
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment