Commit 2ff87020 authored by Breixo Senra's avatar Breixo Senra

Menu.xhtml añadido

parent 5ff6ed34
......@@ -52,6 +52,8 @@ public class LoginManagedBean {
return redirectTo(this.getAdminViewId());
} else if (this.isOwner()) {
return redirectTo(this.getOwnerViewId());
} else if (this.isVet()) {
return redirectTo(this.getVetViewId());
} else {
return redirectTo(this.getViewId());
}
......@@ -88,6 +90,10 @@ public class LoginManagedBean {
return "/admin/owners.xhtml";
}
private String getVetViewId() {
return "/vet/menu.xhtml";
}
private boolean isAdmin() {
return this.isUserInRole("ADMIN");
}
......@@ -96,6 +102,10 @@ public class LoginManagedBean {
return this.isUserInRole("OWNER");
}
private boolean isVet() {
return this.isUserInRole("VET");
}
private boolean isUserInRole(String role) {
return FacesContext.getCurrentInstance().getExternalContext()
.isUserInRole(role);
......
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough">
<head>
<title>Vet Menu</title>
</head>
<body>
<ui:composition template="../WEB-INF/template.xhtml">
<ui:define name="jumbotron">
<h2>Menu</h2>
<div>Bienvenido al menú de gestión de veterinarios:</div>
</ui:define>
<ui:define name="content">
<h:form>
<p:menu>
<p:menuitem value="Gestión Vacunas"
url="#{request.contextPath}/vet/vaccines.xhtml"/>
<p:menuitem value="Asignación de Mascotas"
url="#{request.contextPath}/vet/pets.xhtml"/>
<p:menuitem value="Listado de Vacunas Asignadas"
url="#{request.contextPath}/vet/supervisedPets.xhtml"/>
</p:menu>
</h:form>
</ui:define>
</ui:composition>
</body>
</html>
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