mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-20 12:45:35 +00:00
Bug 4894: secured removeFile method in FileUploadServlet for
AmazonS3FileStorageServiceImpl
This commit is contained in:
+6
-1
@@ -118,9 +118,14 @@ public class AmazonS3FileStorageServiceImpl extends BaseFileStorageServiceImpl i
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFile(URI uri) throws InvalidPropertiesException, OperationFailedException {
|
||||
public void removeFile(URI uri) throws InvalidPropertiesException, OperationFailedException, UnauthorizedException {
|
||||
String key = uri.getPath().substring(uri.getPath().lastIndexOf("/")+1);
|
||||
AmazonS3Client s3Client = createS3Client();
|
||||
|
||||
SecurityUtils.getSubject().checkPermission(
|
||||
SecuredDomainType.FILE_STORAGE.getStringPermissionForTypeRelativeIdentifier(DefaultActions.DELETE,
|
||||
new TypeRelativeObjectIdentifier(key)));
|
||||
|
||||
try {
|
||||
s3Client.deleteObject(new DeleteObjectRequest(bucketName.getValue(), key));
|
||||
} catch (AmazonClientException e) {
|
||||
|
||||
Reference in New Issue
Block a user