|
|
@ -25,6 +25,7 @@ import org.springframework.core.io.ByteArrayResource; |
|
|
import org.springframework.http.CacheControl; |
|
|
import org.springframework.http.CacheControl; |
|
|
import org.springframework.http.HttpHeaders; |
|
|
import org.springframework.http.HttpHeaders; |
|
|
import org.springframework.http.HttpStatus; |
|
|
import org.springframework.http.HttpStatus; |
|
|
|
|
|
import org.springframework.http.MediaType; |
|
|
import org.springframework.http.ResponseEntity; |
|
|
import org.springframework.http.ResponseEntity; |
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
import org.springframework.web.bind.annotation.DeleteMapping; |
|
|
import org.springframework.web.bind.annotation.DeleteMapping; |
|
|
@ -93,7 +94,7 @@ public class ImageController extends BaseController { |
|
|
private static final String IMAGE_KEY_PARAM_DESCRIPTION = "Image resource key, for example thermostats_dashboard_background.jpeg"; |
|
|
private static final String IMAGE_KEY_PARAM_DESCRIPTION = "Image resource key, for example thermostats_dashboard_background.jpeg"; |
|
|
|
|
|
|
|
|
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") |
|
|
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") |
|
|
@PostMapping("/api/image") |
|
|
@PostMapping(value = "/api/image", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|
|
public TbResourceInfo uploadImage(@RequestPart MultipartFile file, |
|
|
public TbResourceInfo uploadImage(@RequestPart MultipartFile file, |
|
|
@RequestPart(required = false) String title) throws Exception { |
|
|
@RequestPart(required = false) String title) throws Exception { |
|
|
SecurityUser user = getCurrentUser(); |
|
|
SecurityUser user = getCurrentUser(); |
|
|
|