\SecureFileExtension
Extension that allows a CMS user to define view access to a particular {@link Folder} and the {@link File}s within.
An access file with rewrite rules is written into the directory
once it's saved in the CMS (see ),
so that the webserver will force a rewrite on the requested assets file path,
turning it into a SilverStripe request so the file can be checked against
access settings.
Beware that this will have a performance impact on file requests that exist in
a that have been secured, as the file request will be treated
as a dynamic request instead of sent directly by the webserver as a static file.
Synopsis
class SecureFileExtension
extends DataExtension
{
- // members
- private static array $db = ;
- private static array $many_many = ;
- private static $current_access_config = NULL;
- private static array $access_config = ;
- // methods
- public array getAccessConfig()
- public void canView()
- public boolean defaultPermissions()
- public void needsAccessFile()
- public void updateCMSFields()
- public void onAfterWrite()
Hierarchy
Extends
- DataExtension
Members
private
- $access_config
- $current_access_config
- $db
- $many_many
Methods
public
- canView()
- defaultPermissions() — Checks for any default access permissions and tests against them if found. Default permssions are set via the Config system.
- getAccessConfig() — Tries to autodetect the current webserver and match it against a registered webserver configuration through access_config. Check _config.php in this module for an example of how those access files are registered through the Config system.
- needsAccessFile()
- onAfterWrite() — Add or remove access rules to the filesystem path.
- updateCMSFields() — Access tab, copied from SiteTree