Bug 4894: secured removeFile method in FileUploadServlet for

AmazonS3FileStorageServiceImpl
This commit is contained in:
Steffen Jacobs
2019-04-03 17:56:11 +02:00
parent 0adcb080d3
commit 46da85349b
@@ -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) {