public static function S3CorsManagedFileHelper::isCorsAvailable in Flysystem - S3 8
Same name and namespace in other branches
- 2.0.x src/S3CorsManagedFileHelper.php \Drupal\flysystem_s3\S3CorsManagedFileHelper::isCorsAvailable()
Determines if CORS upload is available.
Parameters
string $scheme: A file scheme.
\Drupal\Core\Session\AccountInterface $account: A user account object.
Return value
bool TRUE if CORS upload support is available, or FALSE otherwise.
1 call to S3CorsManagedFileHelper::isCorsAvailable()
- S3CorsManagedFileHelper::preProcessCors in src/
S3CorsManagedFileHelper.php - Function preProcessCors prepare the field to use CORS upload.
File
- src/
S3CorsManagedFileHelper.php, line 101
Class
- S3CorsManagedFileHelper
- Helper for altering and processing a managed_file element for CORS upload.
Namespace
Drupal\flysystem_s3Code
public static function isCorsAvailable($scheme, AccountInterface $account = NULL) {
if (!isset($account)) {
$account = \Drupal::currentUser()
->getAccount();
}
$settings = static::getSchemeSettings($scheme);
return !empty($settings['driver']) && $settings['driver'] === 's3' && !empty($settings['config']['cors']) && $account
->hasPermission('use S3 CORS upload');
}