Commit 36f83ffd authored by Breixo Senra's avatar Breixo Senra

Quitados los @PermitAll

parent 5734d1ad
......@@ -14,7 +14,7 @@ import javax.ws.rs.core.Response;
import es.uvigo.esei.xcs.service.AdministratorService;
import es.uvigo.esei.xcs.service.EmailService;
@Path("administrator")
@Path("admin")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class AdministratorResource {
......
......@@ -29,7 +29,7 @@ import es.uvigo.esei.xcs.service.PetService;
*
* @author Miguel Reboiro Jato
*/
@Path("pettt")
@Path("pet")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class PetResource {
......
......@@ -10,6 +10,7 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import es.uvigo.esei.xcs.domain.entities.Administrator;
import es.uvigo.esei.xcs.domain.entities.User;
@Stateless
@RolesAllowed("ADMIN")
......@@ -23,14 +24,14 @@ public class AdministratorService {
}
public List<Administrator> list(int page, int pageSize){
public List<User> list(int page, int pageSize){
if (page < 0) {
throw new IllegalArgumentException("The page can't be negative");
}
if (pageSize <= 0) {
throw new IllegalArgumentException("The page size can't be negative or zero");
}
return em.createQuery("SELECT DISTINCT a FROM Administrator a", Administrator.class)
return em.createQuery("SELECT DISTINCT u FROM User u", User.class)
.setFirstResult((page - 1) * pageSize)
.setMaxResults(pageSize)
.getResultList();
......
......@@ -25,8 +25,7 @@ import es.uvigo.esei.xcs.domain.entities.Vaccination;
* @author Miguel Reboiro Jato
*/
@Stateless
//@RolesAllowed("ADMIN")
@PermitAll
@RolesAllowed("ADMIN")
public class OwnerService {
@PersistenceContext
private EntityManager em;
......
......@@ -30,8 +30,8 @@ import es.uvigo.esei.xcs.domain.entities.Vet;
* @author Miguel Reboiro Jato
*/
@Stateless
//@RolesAllowed("VET")
@PermitAll
@RolesAllowed({"VET", "OWNER"})
//@PermitAll
public class PetService {
@Inject
private Principal currentUser;
......@@ -201,6 +201,7 @@ public class PetService {
}
@RolesAllowed("VET")
public void assignVetToPet(Long petId) {
requireNonNull(petId, "Pet ID can't be null");
//requireNonNull(vetLogin, "Vet login can't be null");
......@@ -219,6 +220,7 @@ public class PetService {
}
@RolesAllowed("VET")
public void unassignVetFromPet(Long petId) {
requireNonNull(petId, "Pet ID can't be null");
//requireNonNull(vetLogin, "Vet login can't be null");
......@@ -240,6 +242,7 @@ public class PetService {
return this.currentUser;
}
@RolesAllowed("VET")
public boolean isAssignedToCurrentVet(Long petId) {
requireNonNull(petId, "Pet ID can't be null");
......
......@@ -9,6 +9,7 @@ import java.text.SimpleDateFormat;
import java.util.List;
import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.inject.Inject;
......@@ -22,7 +23,8 @@ import es.uvigo.esei.xcs.domain.entities.Vaccination;
import es.uvigo.esei.xcs.domain.entities.Vaccine;
@Stateless
@PermitAll
@RolesAllowed("VET")
//@PermitAll
public class VaccinationService {
@Inject
private Principal currentUser;
......
......@@ -18,8 +18,8 @@ import es.uvigo.esei.xcs.domain.entities.Pet;
import es.uvigo.esei.xcs.domain.entities.Vaccine;
@Stateless
@PermitAll
//@RolesAllowed("VET")
//@PermitAll
@RolesAllowed("VET")
public class VaccineService {
@PersistenceContext
private EntityManager em;
......
......@@ -18,8 +18,8 @@ import es.uvigo.esei.xcs.domain.entities.Vaccination;
import es.uvigo.esei.xcs.domain.entities.Vet;
@Stateless
//@RolesAllowed("VET")
@PermitAll
@RolesAllowed("VET")
//@PermitAll
public class VetService {
@Inject
private Principal currentUser;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment