Add annotations for new authorization roles
This commit is contained in:
parent
76fc45760a
commit
3b063f3c65
@ -11,7 +11,6 @@ import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
@Path("/actor")
|
||||
@RolesAllowed("MoviesUserRole")
|
||||
public class ActorResource {
|
||||
@Inject
|
||||
private ActorsService actorsService;
|
||||
@ -24,6 +23,7 @@ public class ActorResource {
|
||||
MediaType.APPLICATION_JSON,
|
||||
MediaType.APPLICATION_XML
|
||||
})
|
||||
@RolesAllowed("MSRead")
|
||||
public List<Actor> retrieveAll() {
|
||||
return actorsService.findAllActors();
|
||||
}
|
||||
@ -34,12 +34,14 @@ public class ActorResource {
|
||||
MediaType.APPLICATION_XML
|
||||
})
|
||||
@Path("/{id}")
|
||||
@RolesAllowed("MSRead")
|
||||
public Actor retrieve(@PathParam("id") long id) {
|
||||
return actorsService.findActorById(id);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("/{id}")
|
||||
@RolesAllowed("MSWrite")
|
||||
public void delete(@PathParam("id") long id) {
|
||||
actorsService.removeActorById(id);
|
||||
}
|
||||
@ -49,6 +51,7 @@ public class ActorResource {
|
||||
MediaType.APPLICATION_JSON,
|
||||
MediaType.APPLICATION_XML
|
||||
})
|
||||
@RolesAllowed("MSWrite")
|
||||
public Response create(Actor actor) {
|
||||
actor.setId(null); // Make sure that a new actor is added, not overwriting existing one
|
||||
List<Actor> newActors = actorsService.saveActor(List.of(actor));
|
||||
@ -63,6 +66,7 @@ public class ActorResource {
|
||||
MediaType.APPLICATION_JSON,
|
||||
MediaType.APPLICATION_XML
|
||||
})
|
||||
@RolesAllowed("MSWrite")
|
||||
@Path("/{id}")
|
||||
public void update(@PathParam("id") long id, Actor actor) {
|
||||
actor.setId(id);
|
||||
|
@ -14,7 +14,6 @@ import java.util.logging.Logger;
|
||||
|
||||
@Stateless
|
||||
@TransactionManagement(value=TransactionManagementType.CONTAINER)
|
||||
@RolesAllowed("MoviesUserRole")
|
||||
public class ActorsService {
|
||||
private static final Logger LOGGER = Logger.getLogger(ActorsService.class.getName());
|
||||
|
||||
|
@ -41,6 +41,7 @@ public class StudioResource {
|
||||
|
||||
@DELETE
|
||||
@Path("/{id}")
|
||||
@RolesAllowed("MSWrite")
|
||||
public void delete(@PathParam("id") long id) {
|
||||
studiosService.removeStudioById(id);
|
||||
}
|
||||
@ -50,6 +51,7 @@ public class StudioResource {
|
||||
MediaType.APPLICATION_JSON,
|
||||
MediaType.APPLICATION_XML
|
||||
})
|
||||
@RolesAllowed("MSWrite")
|
||||
public Response create(Studio studio) {
|
||||
studio.setId(null); // Make sure that a new studio is added, not overwriting existing one
|
||||
List<Studio> newStudios = studiosService.saveStudio(List.of(studio));
|
||||
@ -65,6 +67,7 @@ public class StudioResource {
|
||||
MediaType.APPLICATION_XML
|
||||
})
|
||||
@Path("/{id}")
|
||||
@RolesAllowed("MSWrite")
|
||||
public void update(@PathParam("id") long id, Studio studio) {
|
||||
studio.setId(id);
|
||||
studiosService.saveStudio(List.of(studio));
|
||||
|
@ -14,7 +14,6 @@ import java.util.logging.Logger;
|
||||
|
||||
@Stateless
|
||||
@TransactionManagement(value=TransactionManagementType.CONTAINER)
|
||||
@RolesAllowed("MoviesUserRole")
|
||||
public class StudiosService {
|
||||
private static final Logger LOGGER = Logger.getLogger(StudiosService.class.getName());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user