lab6 mvc done
This commit is contained in:
parent
322353ff16
commit
2eaf84e681
@ -3,6 +3,7 @@ package ru.ulstu.is.sbapp.controllers;
|
||||
import javax.validation.Valid;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import ru.ulstu.is.sbapp.configuration.WebConfiguration;
|
||||
import ru.ulstu.is.sbapp.database.model.Artist;
|
||||
@ -35,7 +36,7 @@ public class AlbumController {
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Secured({UserRole.AsString.ADMIN})
|
||||
@PreAuthorize("hasAuthority('ROLE_ADMIN')")
|
||||
public AlbumDTO createAlbum(@RequestBody @Valid AlbumDTO albumDTO){
|
||||
return new AlbumDTO(albumService.addAlbum(albumDTO.getAlbumName()));
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package ru.ulstu.is.sbapp.controllers;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import ru.ulstu.is.sbapp.configuration.WebConfiguration;
|
||||
import ru.ulstu.is.sbapp.database.model.UserRole;
|
||||
@ -32,7 +33,7 @@ public class ArtistController {
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Secured({UserRole.AsString.ADMIN})
|
||||
@PreAuthorize("hasAuthority('ROLE_ADMIN')")
|
||||
public ArtistDTO createArtist(@RequestBody @Valid ArtistDTO artistDTO){
|
||||
return new ArtistDTO(artistService.addArtist(artistDTO.getArtistName(), artistDTO.getGenre()));
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package ru.ulstu.is.sbapp.controllers;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import ru.ulstu.is.sbapp.configuration.WebConfiguration;
|
||||
import ru.ulstu.is.sbapp.database.model.UserRole;
|
||||
@ -35,7 +36,7 @@ public class SongController {
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Secured({UserRole.AsString.ADMIN})
|
||||
@PreAuthorize("hasAuthority('ROLE_ADMIN')")
|
||||
public SongDTO createSong(@RequestBody @Valid SongDTO songDTO){
|
||||
return new SongDTO(songService.addSong(songDTO.getSongName(), songDTO.getDuration()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user