Skip to content

Commit f4b6e3d

Browse files
committed
disallow user without perms to save downloaded image
1 parent 051a651 commit f4b6e3d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/ru/mystamps/web/controller/SeriesController.java

+6
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,12 @@ public String processInput(
207207
request.removeAttribute(DownloadImageInterceptor.ERROR_CODE_ATTR_NAME);
208208
}
209209

210+
// To ensure that user without permission can't save downloaded image, we clear this image
211+
// TODO: try to not download file in the interceptor if user doesn't have permissions
212+
if (!SecurityContextUtils.hasAuthority(Authority.DOWNLOAD_IMAGE)) {
213+
form.setDownloadedImage(null);
214+
}
215+
210216
if (result.hasErrors()) {
211217
String lang = LocaleUtils.getLanguageOrNull(userLocale);
212218

0 commit comments

Comments
 (0)