|
@ -41,6 +41,7 @@ public class DemoBeanLogin implements Serializable { |
|
|
private String user; |
|
|
private String user; |
|
|
private static String http = "pinchilink"; |
|
|
private static String http = "pinchilink"; |
|
|
private boolean permisos = false; |
|
|
private boolean permisos = false; |
|
|
|
|
|
private boolean agregaciones = false; |
|
|
|
|
|
|
|
|
public Usuarios getUsuarios() { |
|
|
public Usuarios getUsuarios() { |
|
|
return usuarios; |
|
|
return usuarios; |
|
@ -58,6 +59,14 @@ public class DemoBeanLogin implements Serializable { |
|
|
this.rol = rol; |
|
|
this.rol = rol; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isAgregaciones() { |
|
|
|
|
|
return agregaciones; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setAgregaciones(boolean agregaciones) { |
|
|
|
|
|
this.agregaciones = agregaciones; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public String getUser() { |
|
|
public String getUser() { |
|
|
return user; |
|
|
return user; |
|
|
} |
|
|
} |
|
@ -102,7 +111,6 @@ public class DemoBeanLogin implements Serializable { |
|
|
|
|
|
|
|
|
System.out.println(rol); |
|
|
System.out.println(rol); |
|
|
httpSession.setAttribute(http, "true"); |
|
|
httpSession.setAttribute(http, "true"); |
|
|
permiso(); |
|
|
|
|
|
System.out.println(permisos); |
|
|
System.out.println(permisos); |
|
|
usuarios = new Usuarios(); |
|
|
usuarios = new Usuarios(); |
|
|
return "productoLista.xhtml"; |
|
|
return "productoLista.xhtml"; |
|
@ -128,7 +136,7 @@ public class DemoBeanLogin implements Serializable { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void verificarAcceso(String rolesRequeridos) { |
|
|
public void verificarAcceso(String rolesRequeridos, String nombreDeLaPagina) { |
|
|
String[] roles = rolesRequeridos.split(","); |
|
|
String[] roles = rolesRequeridos.split(","); |
|
|
boolean accesoPermitido = false; |
|
|
boolean accesoPermitido = false; |
|
|
for (String rolRequerido : roles) { |
|
|
for (String rolRequerido : roles) { |
|
@ -141,22 +149,105 @@ public class DemoBeanLogin implements Serializable { |
|
|
FacesContext context = FacesContext.getCurrentInstance(); |
|
|
FacesContext context = FacesContext.getCurrentInstance(); |
|
|
NavigationHandler handler = context.getApplication().getNavigationHandler(); |
|
|
NavigationHandler handler = context.getApplication().getNavigationHandler(); |
|
|
handler.handleNavigation(context, null, "productoLista.xhtml?faces-redirect=true"); |
|
|
handler.handleNavigation(context, null, "productoLista.xhtml?faces-redirect=true"); |
|
|
} |
|
|
} else { |
|
|
} |
|
|
switch (nombreDeLaPagina) { |
|
|
|
|
|
//
|
|
|
public void permiso() { |
|
|
case "productoLista": |
|
|
switch (rol) { |
|
|
|
|
|
case "admin": |
|
|
switch (rol) { |
|
|
permisos = true; |
|
|
case "admin": |
|
|
break; |
|
|
permisos = true; |
|
|
case "auxiliar": |
|
|
agregaciones = true; |
|
|
permisos = false; |
|
|
break; |
|
|
break; |
|
|
case "almacenista": |
|
|
case "almacenista": |
|
|
permisos = true; |
|
|
permisos = false; |
|
|
agregaciones = true; |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
case "auxiliar": |
|
|
permisos = false; |
|
|
permisos = false; |
|
|
|
|
|
agregaciones = false; |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
permisos = false; |
|
|
|
|
|
agregaciones = false; |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
//
|
|
|
|
|
|
case "marcaLista": |
|
|
|
|
|
|
|
|
|
|
|
switch (rol) { |
|
|
|
|
|
case "admin": |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
case "almacenista": |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
case "auxiliar": |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
permisos = false; |
|
|
|
|
|
agregaciones = false; |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
//
|
|
|
|
|
|
case "usuariosLista": |
|
|
|
|
|
|
|
|
|
|
|
switch (rol) { |
|
|
|
|
|
case "admin": |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
case "almacenista": |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
case "auxiliar": |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
permisos = false; |
|
|
|
|
|
agregaciones = false; |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
//
|
|
|
|
|
|
case "proveedorLista": |
|
|
|
|
|
|
|
|
|
|
|
switch (rol) { |
|
|
|
|
|
case "admin": |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
case "almacenista": |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
case "auxiliar": |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
permisos = false; |
|
|
|
|
|
agregaciones = false; |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
//
|
|
|
|
|
|
case "ubicacionLista": |
|
|
|
|
|
|
|
|
|
|
|
switch (rol) { |
|
|
|
|
|
case "admin": |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
case "almacenista": |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
case "auxiliar": |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
permisos = false; |
|
|
|
|
|
agregaciones = false; |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|