This content has been marked as final.
Show 2 replies
-
1. Re: Authorization check failed for expression
gus888 May 14, 2009 4:14 PM (in response to aalves)It should be:
@Restrict("#{s:hasRole('admin') or s:hasRole('operador')}")
-
2. Re: Authorization check failed for expression
aalves May 14, 2009 4:50 PM (in response to aalves)Hi,
I noticed the mistake, but it still doesn´t work.
I wrote a log in the jps to see if I have the role and it says that I do, but then when I enter on the method it says that I do not have it.
Do I have to inject anything? it was working before. This is the code of my backing object:@Name("crearActividadAction") @Scope(ScopeType.PAGE) public class CrearActividadAction { @Logger private Log log; @In StatusMessages statusMessages; private Integer numeroCampos; private String nombre; private String descripcion; private List<Campo> tiposCampoSeleccionados; private List<Tipocampo> tiposCampos; public CrearActividadAction() { tiposCampoSeleccionados=new ArrayList<Campo>(); } @Restrict("#{s:hasRole('admin') or s:hasRole('operador')}") public String salvar() { ActividadService actividadService = new ActividadService(); UsuarioService usuarioService = new UsuarioService(); CampoService campoService = new CampoService(); Actividad actividad = new Actividad(); actividad.setNombre(nombre); actividad.setDescripcion(descripcion); Usuario usuario = (Usuario)Contexts.getSessionContext().get("usuario"); actividad.setLugar(usuario.getLugar()); actividadService.save(actividad); for(Campo campo : tiposCampoSeleccionados) { campo.setActividad(actividad); campoService.save(campo); } Contexts.getSessionContext().set("idActividad", actividad.getId()); return "success"; } public List<Tipocampo> getTiposCampos() { return new TipocampoList().getResultList(); } public void setTiposCampos(List<Tipocampo> campos) { this.tiposCampos=campos; } public void setTiposCamposSeleccionados(List<Campo> seleccionados) { this.tiposCampoSeleccionados=seleccionados; } public List<Campo> getTiposCamposSeleccionados() { return this.tiposCampoSeleccionados; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public Integer getNumeroCampos() { return numeroCampos; } public void setNumeroCampos(Integer numeroCampos) { this.numeroCampos = numeroCampos; } public void addCampo() { tiposCampoSeleccionados.add(new Campo()); System.out.print("hola"); } public void deleteCampo(int i) { tiposCampoSeleccionados.remove(i); } }