Moved @Secured to the class level for MemberController & UploadController
This commit is contained in:
parent
6025642bbb
commit
a97df591a7
@ -172,6 +172,7 @@ class ImageController
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/user")
|
||||
@Secured
|
||||
class MemberController
|
||||
@Autowired constructor(
|
||||
val memberRepository: MemberRepository
|
||||
@ -186,7 +187,6 @@ class MemberController
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Secured
|
||||
fun updateLoggedInUser(@Valid @ModelAttribute userData: DisplayUser, @AuthenticationPrincipal userDetails: CustomUserDetails, model: Model): String {
|
||||
if (userData.id == userDetails.getId() && passwordEncoder().matches(userData.oldPassword, userDetails.password)) {
|
||||
val user = memberRepository.findById(userDetails.getId()).get()
|
||||
@ -205,6 +205,7 @@ class MemberController
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/upload")
|
||||
@Secured
|
||||
class UploadController
|
||||
@Autowired constructor(
|
||||
val imageRepository: ImageRepository,
|
||||
@ -221,7 +222,6 @@ class UploadController
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Secured
|
||||
fun uploadFile(
|
||||
@AuthenticationPrincipal userDetails: CustomUserDetails,
|
||||
@RequestParam file: MultipartFile,
|
||||
@ -240,7 +240,6 @@ class UploadController
|
||||
}
|
||||
|
||||
@DeleteMapping("/d/{imageID}")
|
||||
@Secured
|
||||
@Transactional
|
||||
fun deleteUpload(@PathVariable imageID: Long, @AuthenticationPrincipal userDetails: CustomUserDetails): String {
|
||||
val target = imageRepository.findById(imageID)
|
||||
|
Loading…
Reference in New Issue
Block a user