Home

TOMO 2 - Repositorio CISC

image

Contents

1. Mensajes java package com bvg comun web ui public class Mensajes Mensajes Generales public static final String APP_MENSAJE_GUARDADO app mensaje guardado public static final String APP_MENSAJE_BORRADO app mensaje borrado public static final String APP_MENSAJE_NO_EXISTE app mensaje no_existe public static final String APP_MENSAJE_NOMBRES_NAVES_NO_COINCIDEN app mensaje nombres_no_coinciden public static final String APP_MENSAJE_TRANSACCION_EXITOSA app mensaje transaccion_exitosa public static final String APP_MENSAJE_NO_USERLOGIN app mensaje no_userlogin public static final String APP_MENSAJE_CAMBIO_NOMBRE_NO_AUTORIZADO app mensaje cambio_nombre_no_autorizado public static final String APP_MENSAJE_NOMBRES_NAVES_NO_NOMBRE_ANTERIOR app mensaje cambio_nombre_no_nombre_anterior Mensajes de Error public static final String APP_MENSAJE_ERROR app mensaje error public static final String APP MENSAJE ERROR EXCEPCION app mensaje error excepcion Botones public static final String WEB Ul BOTON CREAR web ui boton crear public static final String WEB Ul BOTON CONSULTAR web ui boton consultar 62 public static final String WEB Ul BOTON EDITAR web ui boton editar public static final String WEB Ul BOTON GRABAR web ui boton grabar public static final String WEB Ul BOTON CANCELAR web ui boton cancelar public static final String WEB Ul BOTON ELIMINAR web ui
2. public Usuario getUsuariolngreso return this usuariolngreso public void setUsuariolngreso Usuario user this usuariolngreso user public Usuario getUsuarioModificacion return this usuarioModificacion public void setUsuarioModificacion Usuario user this usuarioModificacion user EntidadAuditableEliminable java package com bvg comun persistencia public abstract class EntidadAuditableEliminable extends EntidadAuditable implements Eliminable protected String estado public String getEstado return estado public void setEstado String activo estado activo EntidadEliminable java package com bvg comun persistencia public abstract class EntidadEliminable extends Entidad implements Eliminable protected String estado public String getEstado return estado public void setEstado String activo estado activo EntidadNatural java package com bvg comun persistencia public abstract class EntidadNatural protected String id public EntidadNatural public abstract String getld public void setld String id this id id public boolean isNew return this id null Securitylmpl java package com bvg comun security dao import java util ArrayList import java util Iterator import java util List import org springframework dao DataAccessException 33 34 import org springframework orm hibern
3. public void setEstado String estado this estado estado public String getEstado return estado public void setRoles Set roles this roles roles public Set getRoles return roles public Collection getCredenciales List opciones new ArrayList for Iterator iter roles iterator iter hasNext Rol rol Rol iter next for Iterator iterator rol getMenus iterator iterator hasNext Menu opcion Menu iterator next opciones add opcion return opciones public String getLoginName return getld public boolean validaPassword String intento String usrPasswd getClave String intentoSha SHA1BASE64 encriptar intento if usrPasswd null return usrPasswd trim equals intentoSha return false public boolean isActivo return getEstado null amp amp getEstado compareTo Eliminable ESTADO_ACTIVO 0 true false public Persona getPersona return persona public void setPersona Persona persona this persona persona 47 48 public String getNombre return nombre public void setNombre String nombre this nombre nombre public String getPregunta return pregunta public void setPregunta String pregunta this pregunta pregunta public String getRespuesta return respuesta public void setRespuesta String respuesta this
4. 70 if rol2 getld compareTo Long valueOf id rol 0 rol rol2 break for Iterator iter usuario getRoles iterator iter hasNext Rol rol2 Rol iter next if rol2 getld compareTo Long valueOf id rol 0 rol null break if rol null usuario getRoles add rol manager guardarObjeto usuario msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP MENSAJE _ TRANSACCION EXITOSA usuario getNombre rol getNombre else msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR El rol ya ha sido asignado a este usuario anteriormente else msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP_MENSAJE_ERROR Escoja un rol para asignarlo al usuario else msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR Escoja un usuario para agregar un rol saveMessages request msg return editarUsuario mapping form request response public ActionForward quitarRol ActionMapping mapping ActionForm form HttpServletRequest request HtipServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION String id usuario request getParameter id usuario ActionMessages msg new ActionErrors if id us
5. lt form property name rol type com bvg comun security model auth Rol gt lt form bean gt lt form bean name menuForm type org apache struts validator DynaValidatorForm gt lt form property name menu type com bvg comun security model auth Menu gt lt form bean gt lt form bean name personaForm type org apache struts validator DynaValidatorForm gt lt form property name persona type com bvg comun security model auth Persona gt lt form bean gt lt form beans gt Global Forward Definitions lt global forwards gt 116 Generales forward name paginaEnBlanco path web jsp inlcude blanco jsp gt lt forward name paginaMensajes path web jsp include pagina_mensajes jsp gt forward name login path login jsp gt forward name logoff pathz logoff jsp gt lt global forwards gt Action Mapping Definitions lt action mappings gt action path global type org springframework web struts DelegatingActionProxy name nullForm scope session parameter method validate false gt lt forward name index path intro jsp gt lt action gt action path security type org springframework web struts DelegatingActionProxy name securityForm scope session parameter method valida e false gt Persona lt forward name listarPersonas path web jsp security listar_personas jsp gt lt forward name editarPersona path web jsp security edit
6. lt body topmargin 0 gt lt table width 100 border 0 cellspacing 2 cellpadding 2 gt Error Messages lt logic messagesPresent gt lt tr gt lt td class error gt Error lt br gt lt html messages id error gt error lt br gt lt html messages gt lt td gt lt tr gt lt logic messagesPresent gt 91 Success Messages lt logic messagesPresent message true gt lt tr gt lt td class mensaje gt Mensaje lt br gt html messages id message message true gt message lt br gt html messages lt td gt lt tr gt lt logic messagesPresent gt lt table gt lt body gt lt html gt taglib jsp lt page contentT ype text html charset windows 1252 gt lt taglib uri http jakarta apache org taglibs string 1 1 prefix str gt lt taglib uri http jakarta apache org struts tags html prefix html gt lt taglib uri http jakarta apache org struts tags bean prefix bean gt lt taglib uri http java sun com jsp jstl core prefix c gt lt taglib uri http java sun com jsp jstl fmt prefix fmt gt lt taglib uri http displaytag sf net prefix display gt cambio_clave jsp lt include file web jsp include taglibs jsp gt lt html gt lt head gt lt include file web jsp include include jsp gt lt head gt lt body gt lt table width 100 border 0 cellspacing 2 cellpadding 1 style margin top 0 gt
7. lt c if test empty ACCION gt lt c set var ACCION value security gt lt c if gt html form action ACCION onsubmit document forms 0 name usuarioForm return validateUsuarioForm this gt html hidden property method value guardarUsuario gt html hidden property ejecutar_metodo value METODO gt lt html hidden property id usuario value usuario id gt lt html hidden property isOlvido value param isOlvido gt html hidden property j_u value param j_u gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt td class cab tabla no borde width 90 gt lt bean message key web ui usuario info gt lt td gt lt td align right gt lt html submit styleClass button onclick this form method value guardarUsuario key web ui boton grabar gt lt html submit gt lt td gt lt td width 1 gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt gt lt bean message 92 lt td class cab_tabla gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla colspan 2 gt lt bean message key web ui usuario cambio gt lt td gt lt tr gt lt tr gt lt td class cab_form width 20 gt lt bean message key web ui usuario id gt lt td gt lt td class det_form gt usuario id lt td gt lt tr gt lt tr gt lt
8. msg errors maxlength jsFunction org apache commons validator javascript validateMaxLength gt lt validator name mask classname org apache struts validator FieldChecks method validateMask methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends msg errors invalid gt lt validator name byte classname org apache struts validator FieldChecks method validateByte methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends msg errors byte jsFunctionName Byte Validations 5 lt validator name short classname org apache struts validator FieldChecks method validateShort methodParams java lang Object 120 org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends msg errors short jsFunctionName ShortValidations gt lt validator name integer classname org apache struts validator FieldChecks method validatelnteger methodParams java lang Object org apa
9. web jsp pr Fig 2 21 Listar menus por estado 21 2 3 1 6 Listar los men s por agrupados o no agrupados La consulta de los men s agrupados nos muestra los men s contenedores de otros menus a los que se les denomina submen s La consulta de los men s no agrupados nos muestra cada uno de los menus y submen s que se han creado en el sistema est n o no contenidos en otro Usuario ADMIN W Salir Consulta de Menus Agregar Administrar Seguridad Criterios de Busqueda Mantenimiento de Usuarios Mantenimiento de Roles O Todos Oun Mantenimiento de Menus Estado ACTVO Y Mostrable SI v Mostrar Menus Agrupados AGRUPADOS v AGRUPADOS Resultado INO AGRUPADOS Encontrados 3 registros mostrando todos los registros Pag 1 Escoger Codigo Nombre Estado Menus Nombre URL O 7 E Seguridad ACTIVO Mantenimiento d dat LA do method listarUsuarios url security d Mantenimiento d security do method listarRoles Mantenimiento d Isecurity do method listarMenus Un registro encontrado Pag O hors Pacwinenu Nombre URL url uriMenu SubMenuDeDarwin subMenuDeDarwin Nombre URL Ingreso de Nota d Modificacion de Uu Opciones del Profesor ma NENE Fig 2 22 Listar los men s por agrupados o no agrupados 2 3 1 7 Creaci n de un nuevo Men En consultar men presionamos el bot n agregar en donde nos aparece la ventana siguiente la cual nos permite ingresar el nombre del men el men padre url
10. String id rol request getParameter id rol ActionMessages msg new ActionErrors if id rol null amp amp id rol length gt 0 String id menu request getParameter id menu if id menu null amp amp id menu length gt 0 Rol rol manager findRolWithMenus id rol Menu menu null for Iterator iter manager getMenus null iterator iter hasNext Menu menu2 Menu iter next if menu2 getld compareTo Long valueOf id menu 0 menu menu2 break 75 for Iterator iter 2 rol getMenus iterator iter hasNext Menu menu2 Menu iter next System out printin menu2 getNombre if menu2 getld compareTo Long valueOf id_menu 0 menu null break boolean sw false for Iterator iterator menu2 getMenus iterator iterator hasNext Menu menu3 Menu iterator next if menu3 getld compareTo Long valueOf id menu 0 menu menus sw true break if sw break if menu null rol getMenus add menu System out printin menu getNombre boolean sw false for Iterator iter menu getMenus iterator iter hasNext Menu menu2 Menu iter next System out printIn menu2 getNombre sw false for Iterator iterator rol getMenus iterator iterator hasNext Menu menu3 Menu iterator next System out printin menu3 getNombre if menu2 getld compareTo menu3 getld 0 sw tru
11. lt struts config gt validation xml lt form validation gt lt formset gt lt form name usuarioForm gt lt field property usuario id depends required gt lt arg position 0 key web ui usuario id gt lt field gt lt field property usuario clave depends required gt lt arg position 0 key web ui usuario clave gt lt field gt field property usuario confirmClave depends required gt arg position 0 key web ui usuario confirmClave gt lt field gt lt field property usuario pregunta depends required gt lt arg position 0 key web ui usuario pregunta gt lt field gt lt field property usuario nombre depends required gt arg position 0 key web ui usuario nombre gt lt field gt lt field property usuario estado depends required gt arg position 0 key web ui eliminable estado gt lt field gt lt form gt lt form name rolForm gt lt field property rol nombre depends required gt arg position 0 key web ui rol nombre gt lt field gt lt field property rol descripcion depends required gt arg position 0 key web ui rol descripcion gt lt field gt lt field property rol estado depends required gt arg position 0 key web ui eliminable estado gt lt field gt lt form gt lt form name menuForm gt field property menu nombre depends required gt arg position 0 key web ui menu nombre gt lt field
12. String dynaForm get textToFind String cmbTextToFind String dynaForm get cmbTextToFind String cmbEstado String dynaForm get cmbEstado String cmbMostrable String dynaForm get cmbMostrable String cmbAgrupados String dynaForm get cmbAgrupados 79 List items null HashMap filtros new HashMap List result new ArrayList if cmbTextToFind null amp amp cmbTextToFind length gt 0 if CmbTextToFind compareTo NOMBRE 0 48 textToFind null amp amp textToFind length gt 0 filtros put nombre like textToFind toUpperCase trim if CmbTextToFind compareTo URL 0 amp amp textToFind null amp amp textToFind length gt 0 filtros put url like textToFind toUpperCase trim if cmbEstado null amp amp cmbEstado length gt O amp amp cmbEstado compareTo TODOS 0 filtros put estado cmbEstado if cmbMostrable null amp amp cmbMostrable length gt 0 filtros put mostrable cmbMostrable else filtros put mostrable S items manager getMenusffiltros for Iterator iter items iterator iter hasNext Menu menu Menu iter next boolean sw false if CmbTextToFind compareTo NOMBRE 0 amp amp textToFind null amp amp textToFind length gt 0 if menu getNombre toUpperCase trim indexOf textToFind toUpperCase trim 1 sw
13. hostremoto lt property gt name url type java lang String update true insert true column urlrequerido not null true lt many to one gt name usuario class com bvg comun security model auth Usuario cascade none outer join auto update true insert true column codigousuario not null true lt property gt name addr type java lang String update true insert true column addrremoto lt property gt name user type java lang String update true insert true column userremoto lt class gt lt hibernate mapping gt Log java public class Log extends Entidad private Usuario usuario 36 Clase que me ayuda a obtener los movimientos de un usuario tales como la fecha en que ingreso a donde acceso y desde donde acceso Estos movimientos se guarda en la base de datos para su respectiva revision package com bvg comun security model auth import java util Date import com bvg comun persistencia Entidad private String url private Date fecha private String host private String user private String addr public Log super public Long getld return id public Date getFecha return fecha public void setFecha Date fecha this fecha fecha public String getHost return host public void setHost String host this host host public String getUrl return url publi
14. lt c if gt lt table gt lt body gt lt html gt Validacion lt html javascript formName rolForm gt lt Mensajes gt lt include file web jsp include mensajes jsp gt editar_usuario jsp lt include file web jsp include taglibs jsp gt lt html gt lt head gt lt include file web jsp include include jsp gt lt head gt lt body gt lt table width 100 border 0 cellspacing 2 cellpadding 1 style margin top 0 gt lt c if test empty ACCION gt lt c set var ACCION value security gt lt c if gt html form action ACCION onsubmit document forms 0 name usuarioForm return validateUsuarioForm this gt html hidden property method value guardarUsuario gt html hidden property ejecutar_metodo value METODO gt html hidden property id usuario value usuario id gt lt html hidden property clave anterior value usuario clave gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla_no_borde width 90 gt lt bean message key web ui usuario info gt lt td gt lt td align right gt lt html submit styleClass button onclick this form method value guardarUsuario gt bean message key web ui boton grabar gt lt html submit gt lt td gt lt td width 1 gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt td gt
15. lt tr gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla colspan 2 gt lt bean message key web ui usuario datos gt lt td gt lt tr gt lt tr gt lt td class cab_form width 20 gt lt bean message key web ui usuario id gt lt td gt 100 td class det_form gt lt html text property usuario id size 10 maxlength 16 gt lt td gt lt tr gt lt tr gt td class cab_form gt lt bean message key web ui usuario clave gt lt td gt lt td class det_form gt lt html password property usuario clave size 10 maxlength 16 gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui usuario confirmClave gt lt td gt lt td class det_form gt lt html password property usuario confirmClave size 10 maxlength 16 gt lt td gt lt tr gt lt tr gt td class cab_form gt lt bean message key web ui usuario nombre gt lt td gt lt td class det_form gt lt html text property usuario nombre size 15 maxlength 250 gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui usuario pregunta gt lt td gt lt td class det_form gt lt html select property usuario pregunta gt lt html option value NOMBRE DE MI PERRO gt NOMBRE DE MI PERRO lt html option gt html option value NOMBRE DE MI MAMA gt NOMBRE DE MI MAMA lt html option gt
16. lt hibernate mapping gt lt class gt name com bvg comun security model auth Usuario table USUARIOS lt id name id column codigousuario type java lang String gt lt generator class assigned gt lt generator gt lt id gt lt property name clave type java lang String update true insert true column clave not null true l gt lt property name estado type java lang String update true insert true column estado not null true l gt lt set name roles table USUARIOROL lazy false cascade save update sort unsorted order by codigorol asc gt lt key column codigousuario gt lt key gt lt many to many class com bvg comun security model auth Rol column codigorol outer join auto l gt lt set gt lt property name nombre 44 type java lang String update true insert true column nombre gt lt property name pregunta type java lang String update true insert true column pregunta l gt lt property name respuesta type java lang String update true insert true column respuesta gt lt property name nombreUsuario type java lang String update true insert true column usuario gt lt property name fechaSolicitud type java util Date update true insert true column fechasolicitud gt lt property name estadoCambio type java lang String update true insert
17. tr gt lt html form gt lt c if test rol new gt 97 lt html form action ACCION onsubmit document forms 0 name rolForm return validateRolForm this gt html hidden property method value quitarMenu gt lt html hidden property ejecutar_metodo value METODO gt html hidden property id_rol value rol id gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla_no_borde width 90 gt lt bean message key web ui rol menus gt lt td gt lt td align right gt lt html button styleClass button onclick var popup window open contextPath security do method listarMenus amp id_rol rol id popup height 400 width 800 status yes resizable yes toolbar no menubar no scrollbars yes location no if popup popup focus property gt lt bean message key web ui boton crear gt lt html button gt lt td gt lt td width 1 gt lt c if test not empty menus gt lt td align right gt html submit styleClass button onclick this form method value quitarMenu gt lt bean message key web ui boton quitar gt lt html submit gt lt td gt lt td width 1 gt lt c if gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt display table name menus id item class esmena requestURI ACCION do method editarRol style width 100 sort
18. 1 pos buf toString indexOf pos 2 pos buf toString indexOf while pos 1 buf replace pos pos 1 50 51 pos buf toString indexOf pos 2 switch patternType case PATH_TYPE buf insert 0 buf insert buf length 4 buf append break case EXTENSION_TYPE buf append break case EXACT_TYPE buf insert 0 buf append break convertedPattern buf toString protected void initCompiledPattern PatternCompiler compiler throws Exception compiledPattern compiler compile convertedPattern PerlbCompiler READ ONLY MASK public int compareTo Object obj throws ClassCastExceptionf URL Pattern other URLPattern obj if this equals other return 0 int c patternType other patternT ype if c 0 switch patternType case PATH_TYPE c other pathLength pathLength if c 0 break case EXACT_TYPE case EXTENSION_TYPE case DEFAULT_TYPE c order other order return C URLPatternFactory java URLPatternFactory crea instancias de URLPattern package com bvg comun security util matcher import org apache oro text regex PatternCompiler 52 import org apache oro text regex Perl5Compiler public class URLPatternFactory protected PatternCompiler compiler public URLPatternFactory compiler new Perl5Compiler public URLPatternMatcher createURLPatte
19. 2 23 3 Creaci n de un nuevo men 2 3 1 8 Creaci n de un Submenu Es similar a la creaci n de un menu principal solamente que se llena el campo de men padre y el nivel ser 1 2 n seg n el numero de submenus Usuario ADMIN Sali ACADEMICO Informaci n del Menu Administrar Seguridad Mantenimiento de Usuarios FT J FJZ gt Mantenimiento de Roles Nombre del Men Ingreso de Alumnos Mantenimiento de Menus Datos de acceso y control Menu Padre 10908 Opciones del Alumno Url de Acci n o Permiso Iweb isp alumno ngreso de alur mnos Orden 1 Mostrable S Estado ACTVO v ACTIVO Fig 2 24 1 Creacion de Submenu Se ingresa el nombre del submen y se busca el padre del mismo escogemos el men padre dando clic en el c digo 24 Informaci n del Menu Administrar Seguridad Datos de acceso y control Mantenimiento de Usuarios Mantenimiento de Roles Mantenimiento de Menus Nombre del Men Ingreso de Alumnos Men Padre http 127 0 0 1 8988 Sistema de Administraci n Acad mica Microsoft Internet Explorer Consulta de Menus Criterios de B squeda 9 Todos Estado ACTVO v Mostrar Menus Agrupados AGRUPADOS Resultado Encontrados 4 registros mostrando todos los registros P g 1 Nombre Estado Escoger Menus Nombre URL ok Administrar Seguridad activo Mantenimiento d security do method listarUsuarios p url secur
20. ACCION value security gt lt c if gt lt html form action ACCION onsubmit document forms 0 name menuForm return validateMenuForm this gt lt html hidden property method value guardarUsuario gt lt html hidden property ejecutar_metodo value METODO gt lt html hidden property id_menu value 5 menu id 5 lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla_no_borde width 90 gt lt bean message key web ui menu info gt lt td gt lt td align right gt lt html submit styleClass button onclick this form method value guardarMenu key web ui boton grabar gt lt html submit gt lt td gt lt td width 1 gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla colspan 2 gt lt bean message key web ui menu datos gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui menu nombre gt lt td gt lt td class det_form gt lt html text property menu nombre size 40 maxlength 100 gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui menu id_padre gt lt td gt td class det_form gt lt html text property menu idPadre size 7 maxlength 7 readonly true g
21. Iterator iter lista iterator iter hasNext Usuario usuario Usuario iter next if usuario getld compareTo userlogin 0 amp amp usuario getEstado compareTo Eliminable ESTADO ACTIVO 0 for Iterator iterator usuario getRoles iterator iterator hasNext Rol rol Rol iterator next for Iterator iterator2 roles iterator iterator2 hasNext Rol rol2 Rol iterator2 next if rol getld compareTo rol2 getld 0 amp amp rol getEstado compareTo Eliminable ESTADO ACTIVO for Iterator iterator4 rol2 getMenus iterator iterator4 hasNext Menu menu Menu iterator4 next if menu getEstado compareTo Eliminable ESTADO ACTIVO result add menu return result public void saveLog Log log getHibernateTemplate save log Log hbm xml Mapeo de Tabla LOG y UID hibernate mapping gt lt class name com bvg comun security model auth Log table LOG gt lt id name id column codigolog type java lang Long lt generator class hilo gt lt param name table gt UID lt param gt lt param name column gt codigolog lt param gt lt param name max_lo gt 100 lt param gt lt generator gt lt id gt lt property name fecha type java util Date update true insert true column fecharequerimiento not null true l gt 35 lt property gt name host type java lang String update true insert true column
22. Menu Principal En el menu principal del Administrador se mostraran tres opciones Mantenimiento de Usuarios Mantenimiento de Roles Mantenimiento de Menus Usuario ADMIN X Sali ACADEMICO Administrar Seguridad Mantenimiento de Usuarios Mantenimiento de Roles Mantenimiento de Menus Fig 2 1 Men Inicial del Administrador 2 1 1 Mantenimiento de Usuarios En esta pantalla nos muestra las diferentes formas en que podemos realizar las consultas y la creaci n de los usuarios las cuales pueden ser las siguientes 1 Listar todos los usuarios 2 Listar usuarios por el estado A l 3 Listar usuarios por Nombre 4 Listar por Usuario de Ingreso 5 Creaci n de un Usuario 6 Asignaci n de un Rol a un Usuario Usuario ADMIN X Salir ACADEMICO Consulta de Usuarios Consultar Agregar Administrar Seguridad Criterios de B squeda Mantenimiento de Usuarios 6 0 o Mantenimiento de Roles Todos Nombre Usuario de Ingreso Mantenimiento de Menus Estado Todos V Fig 2 2 Mantenimiento de Usuarios 2 1 1 1 Listar Todos los Usuarios del Sistema Esta consulta puede ser masiva sin filtros listando todos los usuarios que se encuentran almacenados en el sistema Usuario ADMIN Sali ACADEMICO Consulta de Usuarios Consultar Agregar Administrar Seguridad Criterios de B squeda Mantenimiento de Usuarios Mantenimiento de Roles Mantenimiento de Menus Estado Todos O Todos O Usuario de Ingreso Resultado Enc
23. Opciones del Profesor Hing url web jsp pr Fig 2 17 Listar todos los Menus 2 1 3 2 Listar los men s por Nombre Se puede consultar en esta opci n dando clic en Nombre y digitando el nombre del men que se desea obtener informaci n Usuario ADMIN A ACADEMICO Consulta de Menus Consultar Administrar Seguridad Mantenimiento de Usuarios Mantenimiento de Roles Mantenimiento de Menus Criterios de B squeda O Todos Our Estado Todos w Mostrar Menus Agrupados AGRUPADOS Mostrable si Resultado Encontrados 3 registros mostrando todos los registros Pag 1 Escoger Codigo Nombre Estado Menus Nombre URL o M Administrar Seguridad Mantenimiento d security do method listarUsuarios url security d Mantenimiento d security do method listarRoles Mantenimiento d security do method listarMenus Un registro encontrado P g Nombre URL SubMenuDeDarwin subMenuDeDarwin DarwinMenu url uriMenu Nombre Ingreso de Nota U Modificacion de d Opciones del Profesor url web isp pr Fig 2 18 Listar los Men s por Nombre 19 2 3 1 3 Listar menus por url requerido La consulta de los menus que se hace por la direcci n URL que es la cadena de caracteres con la cual se asigna una direcci n Unica a cada uno de los menus de informaci n disponibles nos ayuda a identificar cada jsp que se va a ejecutar la opci n requerida del menu a consultar Usuario ADMIN X Sa
24. PROPAGATION_REQUIRED readOnly lt prop gt prop key load gt PROPAGATION_REQUIRED readOnly lt prop gt lt prop key store gt PROPAGATION_REQUIRED lt prop gt lt props gt lt property gt lt bean gt lt beans gt stuts config xml lt struts config gt lt form beans gt lt form bean name nullForm type org apache struts validator DynaValidatorForm gt lt form bean gt lt form bean name securityForm type org apache struts validator DynaValidatorForm gt lt form property name usuario type com bvg comun security model auth Usuario gt lt form property name rol type com bvg comun security model auth Rol gt lt form property name menu type com bvg comun security model auth Menu gt lt form property name persona type com bvg comun security model auth Persona gt lt form property name textToFind type java lang String gt lt form property name cmbTextToFind type java lang String gt lt form property name cmbEstado type java lang String gt lt form property name cmbMostrable type java lang String gt form property name cmbAgrupados type java lang String gt lt form bean gt lt form bean name usuarioForm type org apache struts validator DynaValidatorForm gt lt form property name usuario type com bvg comun security model auth Usuario gt lt form bean gt lt form bean name rolForm type org apache struts validator DynaValidatorForm gt
25. apache commons validator Validator javax servlet http HttpServletRequest depends double 122 msg errors range gt lt validator name creditCard classname org apache struts validator FieldChecks method validateCreditCard methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends msg errors creditcard gt lt validator name email classname org apache struts validator FieldChecks method validateEmail methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends msg errors email gt lt validator name url classname org apache struts validator FieldChecks method validateUrl methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends msg errors url gt lt validator name includeJavaScriptUtilities classname method methodParams depends msg jsFunction org apache commons validator javascript validateUtilities gt
26. cada uno de los usuarios que tienen acceso al sistema Si fuese el caso de que el usuario no este registrado este no podra tener acceso al sistema acad mico Autentificaci n de Ingreso Usuario Clave Ingresar Olvido su clave Inicio Fig 1 1 Pantalla de Ingreso de Usuario 1 2 Error de Autentificacion Cabe mencionar que si la clave es obviada en el ingreso nos aparecera un mensaje el cual indica que la clave es obligatoria Autentificaci n de Ingreso E Microsoft Internet Explorer xj Usuario admin Clave A Ingrese Clave Olvido su clave Fig 1 2 Error de Autentificaci n 1 3 Clave no valida En esta ventana podemos observar que si cualquiera de los dos par metros necesarios de ingreso esta err neo el sistema me arroja un mensaje indicando el porque se esta denegando el acceso tal como se muestra en la fig 1 3 Autentificaci n de Ingreso Tu login no fue exitoso Intenta de nuevo Raz n Clave no v lida Usuario Clave Ingresar Olvido su clave Fig 1 3 Clave no valida 1 4 Usuarios No Registrado En esta pantalla observamos como aparecera un mensaje de error diciendonos que el usuario no esta registrado en el Sistema por cuanto debemos intentar ingresar nuevamente o comunicarse con el administrador para verificar si esta registrado o activo el usuario Autentificaci n de Ingreso Tu login no fue exitoso Intenta de nuevo Razon Usuario no registrado e
27. d security do method listarMenus Un registro encontrado P g Nombre URL SubMenuDeDarwin subMenuDeDarwin Nombre DarwinMenu url uriMenu Opciones del Profesor EDU Ingreso de Nota url web jsp pr Modificacion de Fig 2 20 Listar por men s mostrables o no 2 3 1 5 Listar menus por estado En esta opci n la consulta puede ser filtrada por el estado del menu Se puede hacer un filtro por Men s Activos en donde se enlista todos los men s a los que se puede tener acceso en el sistema a trav s de la p gina web Men s Inactivos el cual filtra todos los menus que por alguna raz n se han desactivado ya sea porque no se usan o no se requiere Usuario ADMIN Bf Salir ACADEMICO Consulta de Menus Administrar Seguridad Criterios de B squeda Mantenimiento de Usuarios O Mantenimiento de Roles Sy bab Mantenimiento de Menus Estado ACTVO v Mostrable S v Te Mostrar Menus Agrupados A S Resultado Encontrados 3 registros mostrando todos los registros P g 1 Escoger C digo Nombre Estado Menus Nombre URL Administrar Seguridad ACTIVO Mantenimiento d security do method listarUsuarios url security d Mantenimiento d security do method listarRoles Mantenimiento d security do method listarMenus Un registro encontrado Pag Nombre URL SubMenuDeDarwin IsubMenuDeDarwin DarwinMenu url uriMenu Nombre URL Ingreso de Nota Modificacion de J Opciones del Profesor url
28. gt lt field property menu url depends required gt lt arg position 0 key web ui menu url gt lt field gt field property menu orden depends required integer gt lt arg position 0 key web ui menu orden gt lt field gt lt field property menu mostrable depends required gt arg position 0 key web ui mostrable gt lt field gt 118 field property menu estado depends required gt arg position 0 key web ui eliminable estado gt lt field gt lt field property menu idPadre depends float gt arg position 0 key web ui menu id_padre gt lt field gt lt form gt lt formset gt lt form validation gt validator rules xml Aqui se muesira las validaciones por default de los Struts estos son ubicados en algun lugar en el WEB INF y referenciados en el struts config xml bajo los elementos del plug in para la validacion lt form validation gt lt global gt lt validator name required classname org apache struts validator FieldChecks method validateRequired methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest msg errors required gt lt validator namez requiredif classname org apache struts validator FieldChecks method validateRequiredif methodParams java
29. list pagesize 100 defaultorder ascending defaultsort 2 export true gt lt display column title Escoger style text align center gt lt input type radio name id menu value item id checked checked gt lt input gt lt display column gt display column property id title C amp oacute digo style text align left white space nowrap maxLength 40 gt lt display column property nombre title Nombre sortable true style text align left white space nowrap maxLength 40 gt 98 display column property url title Url sortable true style text align left white space nowrap maxLength 40 gt lt display column title Estado style text align center white space nowrap gt lt c if test item estado A gt lt bean message key web ui eliminable estado activo gt lt c if gt lt c if test item estado I gt lt bean message key web ui eliminable estado inactivo gt lt c if gt lt display column gt lt display column title Menus style text align left white space nowrap gt lt c set var sw value false lt c forEach items item menus var menu1 gt lt c forEach items rol menus var menu2 gt cif test menu1 id menu2 id gt lt c set var sw value true gt lt c if gt lt c forEach gt lt c forEach gt cif test sw gt lt display table name item menus id menu class esmena style width 1
30. lt global gt lt form validation gt web xml lt display name gt SISACAD lt display name gt lt description gt SISTEMA DE ADMINISTRACION ACADEMICA SISACAD lt description gt 123 filter lt filter name gt Security Chain lt filter name gt lt filter class gt com bvg comun web security SecurityFilter lt filter class gt lt init param gt lt param name gt loginAuthorization lt param name gt lt param value gt security lt param value gt lt init param gt lt init param gt lt param name gt guestUser lt param name gt lt param value gt INVITADO lt param value gt lt init param gt lt filter gt lt filter mapping gt lt filter name gt Security Chain lt filter name gt lt url pattern gt lt url pattern gt lt filter mapping gt lt listener gt lt listener class gt org springframework web context ContextLoaderListener lt listener class gt lt listener gt lt serviet gt lt serviet name gt action lt serviet name gt lt servlet class gt org apache struts action ActionServlet lt servlet class gt lt init param gt lt param name gt config lt param name gt lt param value gt WEB INF struts config xml lt param value gt lt init param gt lt load on startup gt 3 lt load on startup gt lt servlet gt lt servlet mapping gt lt servlet name gt action lt servlet name gt lt url pattern gt do lt url pattern gt lt servlet mapping gt lt session config gt lt session tim
31. lt html radio gt lt td gt lt td class cab_form gt lt html radio property cmbTextToFind value DESCRIPCION gt lt bean message key web ui descripcion gt lt html radio gt lt td gt lt td class det_form width 20 gt lt html text property textToFind size 30 maxlength 30 gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui eliminable estado gt lt td gt lt td class det_form gt lt html select property cmbEstado gt lt html option value TODOS gt lt bean message key web ui todos gt lt html option gt lt html option value A gt lt bean message key web ui eliminable estado activo gt lt html option gt lt html option value l gt lt bean message key web ui eliminable estado inactivo gt lt html option gt lt html select gt lt td gt lt td class cab_form gt lt td gt lt td class det_form width 20 gt lt td gt lt tr gt lt table gt lt td gt lt tr gt lt c if test not empty items gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla_no_borde width 90 gt lt bean message key web ui resultado gt lt td gt lt c if test param id_usuario null gt lt td align right gt lt html submit styleClass button onclick this form method value editarRol gt lt bean message key web ui boton editar gt lt html submit gt lt
32. lt td width 110px align center valign middle gt lt img src web img advertencia_azul png gt 87 lt td gt lt td width 8px gt lt td class descripcion_portada valign top gt Lo sentimos mucho La informaci amp oacute n que usted est amp aacute solicitando no fue encontrada lt br gt lt br gt La direcci amp oacute n requerida no se encuentra en este servidor lt br gt lt br gt lt br gt Informaci amp oacute n adicional por favor comun amp iacute quese con su administrador de servicios lt td gt lt td width 2px gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td height 10 gt lt tr gt lt table gt lt table align center gt lt tr gt lt td colspan 3 gt lt div id legal_popup align center gt lt span class copyright gt amp copy Sistema de Administraci amp oacute n Acad amp eacute mica lt span gt lt div gt lt td gt lt tr gt lt table gt lt body gt lt html gt 500 jsp lt page language java isErrorPage true gt lt taglib uri http jakarta apache org struts tags bean prefix bean gt lt html gt lt head gt lt include file web jsp include include jsp gt lt head gt lt body gt lt table width 100 border 0 cellspacing 0 cellpadding 0 gt lt tr gt lt td gt lt div id line_logo gt lt table width 100 border 0 gt lt tr gt lt td width 38 gt lt img src web img logo gif gt lt td
33. mapping form request response public ActionForward olvidoClave ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION ActionMessages msg new ActionErrors String isOlvido request getParameter isOlvido if isOlvido null amp amp isOlvido compareTo request getSession getld 0 String param_user request getParameter j_u if param user null amp amp param user length gt 0 f String id usuario request getParameter id usuario Usuario usuario manager findUsuarioByld param user trim toUpperCase if usuario null if id usuario null amp amp id usuario length gt 0 String respuesta request getParameter usuario respuesta if respuesta null amp amp 69 respuesta trim toUpperCase compareTo usuario getRespuesta trim toUpperCase 0 request getSession setAttribute SecurityFilter SESSION USERLOGIN usuario request getSession setAttribute Usuario CLAVE_CAMBIADA Usuario INICIAL return cambioClave mapping form request response else msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP_MENSAJE_ERROR No es la respuesta de la pregunta request setAttribute usuario usua
34. por Estado 2 1 1 3 Listar Usuarios por Nombre Se puede consultar en esta opci n dando clic en Nombre y digitando el nombre y o apellido del usuario que se desea obtener informaci n Usuario ADMIN X Sali ACADEMICO Consulta de Usuarios Administrar Seguridad Criterios de B squeda Mantenimiento de Usuarios O O Carla Mantenimiento de Roles pedos Usuario de Ingreso Mantenimiento de Menus Estado Todos v Resultado Un registro encontrado P g 1 Escoger Nombre Usuario Fecha de Creaci n O Carla Sofia Velasco CVELASCO 15 09 2006 Fig 2 5 Listar Usuarios por Nombre 2 1 1 4 Listar por Usuario de Ingreso Se podra tambien realizar la consulta especifica por usuario escogemos la opci n usuario de ingreso y digitamos el usuario dbriones Usuario ADMIN X Sali Consulta de Usuarios Agregar Administrar Seguridad Criterios de B squeda Mantenimiento de Usuarios i S dbriones Mantenimiento de Roles O Todos Usuario de Ingresd dbrones gt Mantenimiento de Menus Estado Todos Resultado Un registro encontrado P g 1 Escoger Nomi Usuario Fecha de Creaci n O Darwin Briones DBRIONES 15 09 2006 Fig 2 6 Listar por Usuario de Ingreso 2 1 1 5 Creaci n de un Usuario En la figura 2 2 al dar clic en el bot n Agregar nos aparece la siguiente pantalla en la cual nos pedir ciertos datos necesarios del usuario para registrarlo en nuestra base Usuario ADMIN X Sali ACADEMICO Informaci
35. public Usuario findUsuario String usrLogin throws DataAccessException ComunManager java package com bvg comun service import java util ArrayList import java util Calendar import java util HashMap import java util HashSet import java util List import java util Set import com bvg comun model dao ComunDAO import com bvg comun persistencia Auditable import com bvg comun persistencia Eliminable import com bvg comun persistencia Entidad import com bvg comun security model auth Menu import com bvg comun security model auth Rol import com bvg comun security model auth Usuario public class ComunManager implements ComunModelManager protected ComunDAO comunDAO public ComunManager public void setComunDAO ComunDAO comunDAO this comunDAO comunDAO public void guardarObjeto Object objeto comunDAO guardarObjeto objeto public void guardarEntidad Entidad entidad String id usuario if entidad instanceof Auditable Auditable auditable Auditable entidad Usuario user null if id_usuario null user comunDAO findUsuarioByld id usuario else user comunDAO findUsuarioByld ADMIN if entidad isNew auditable getFechalngreso null 55 auditable setFechalngreso Calendar getInstance getTime auditable setUsuariolngreso user auditable setFechaModificacion Calendar getInstance getTime auditable setUsuarioModificacion user if en
36. respuesta respuesta public Date getFechaSolicitud return fechaSolicitud public void setFechaSolicitud Date fechaSolicitud this fechaSolicitud fechaSolicitud public String getConfirmClave return confirmClave public void setConfirmClave String confirmClave this confirmClave confirmClave public String getEstadoCambio return estadoCambio public void setEstadoCambio String estadoCambio this estadoCambio estadoCambio public Date getFechaCambioClave return fechaCambioClave public void setFechaCambioClave Date fechaCambioClave 49 this fechaCambioClave fechaCambioClave public void setNombreUsuario String nombreUsuario public String getNombreUsuario return this getld URLPattern java URLPattern contiene las comparaciones de los URL pattern las asociaciones de los SecurityConstraint y la coleccion de objetos para esos patterns package com bvg comun security util matcher import org apache oro text regex Pattern import org apache oro text regex PatternCompiler import org apache oro text regex PerlbCompiler public class URL Pattern implements Comparable public static final int EXACT TYPE 1 public static final int PATH TYPE 2 public static final int EXTENSION TYPE 3 public static final int DEFAULT TYPE 4 protected String pattern protected String convertedPattern protected Pattern com
37. right gt lt table cellpadding 0 126 cellspacing 0 border 0 gt lt tr gt lt td class usuario app title valign middle gt Usuario lt td gt lt td class usuario_app gt lt c choose gt lt c when test not empty usuario persona nombresCompletos gt usuario gePersona nombresCompletos lt c when gt lt c otherwise gt usuario id lt c otherwise gt lt c choose gt usuario persona nombresCompletos lt td gt lt td width 15px gt lt td valign bottom gt lt img onclick location href logoff jsp style cursor pointer src web img cerrar gif width 14 height 14 gt lt td gt lt td valign middle class usuario_app gt 8nbsp lt a href logoff jsp gt Salir lt a gt lt td gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td colspan 2 valign top align left gt lt img src web img index_4 gif width 23 height 8 gt lt td gt lt tr gt lt tr gt lt td valign top style vertical align top colspan 2 gt lt iframe frameborder 0 marginwidth 0 id iFrameAdmin namez iFrameAdmin scrolling no style width 100 src contextPath global do method bienvenida onload resize this id gt lt iframe gt lt td gt lt tr gt lt table gt lt td gt lt tr gt lt table gt lt body gt lt html gt login jsp lt page language java contentType text html charset ISO 8859 1 pageEncoding ISO 8859 1 gt lt page import com bvg comun web security Securi
38. save update sort unsorted order by orden gt lt key column codigomenupadre gt lt key gt lt one to many class com bvg comun security model auth Menu l gt lt set gt lt property name mostrable type java lang String update true insert true column mostrable not null true l gt lt class gt lt hibernate mapping gt Menu java package com bvg comun security model auth import java util Set import com bvg comun persistencia EntidadEliminable import com bvg comun security util CredencialAcceso public class Menu extends EntidadEliminable implements CredencialAcceso Comparable public static final String MOSTRABLE S public static final String NO_MOSTRABLE N 39 Fields private String nombre private String url private Integer orden private Long idPadre private Set menus private String mostrable Constructor por default public Menu public Long getld return id public String getPattern return url public void setUrl String url this url url public String getUrl return url public void setEstado String estado this estado estado public String getEstado return estado public void setOrden Integer orden this orden orden public Integer getOrden return orden public int compareTo Object o if o null amp amp o instanceof Menu Menu anotherMenu Menu o re
39. style position absolute visibility hidden gt lt div gt lt script language JavaScript vqptag doc level settings is vgp htmI 1 vqp datafile0 side menu js vqgp uid02647682 cdd codebase web js menu cdd codebase647682 web js menu lt script gt lt script language JavaScript vqptag datafile src web js menu side_menu js gt lt script gt script vgptag placement vqp_menuid 647682 language JavaScript gt create_menu 647682 lt script gt lt END NAVSTUDIO MENU TAGS gt
40. td align right gt lt html submit styleClass button onclick this form method value guardarRol gt lt bean message key web ui boton grabar gt lt html submit gt lt td gt lt td width 1 gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla colspan 2 gt lt bean message key web ui rol datos gt lt td gt lt tr gt lt tr gt lt td class cab_form width 20 gt lt bean message key web ui rol nombre gt lt td gt lt td class det_form gt lt html text property rol nombre size 40 maxlength 100 gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui rol descripcion gt lt td gt lt td class det_form gt lt html text property rol descripcion size 40 maxlength 250 gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui eliminable estado gt lt td gt lt td class det_form gt lt html select property rol estado gt lt html option value A gt lt bean message key web ui eliminable estado activo gt lt html option gt html option value I gt lt bean message key web ui eliminable estado inactivo gt lt html option gt lt html select gt lt td gt lt tr gt lt table gt lt td gt lt
41. td gt lt td width 1 gt lt c if gt cif test param id usuario null gt lt td align right gt lt Aqui tienen q poner en alguan parte algo como window close 108 Pa lt html button styleClass button onclick var popup window open contextPath security do method agregarRol amp id_usuario param id_usuario amp id_rol id_selected id_rol iFrameAdmin if popup popup focus property gt bean message key web ui boton crear gt lt html button gt lt td gt lt td width 1 gt lt c if gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt c if test empty METODO gt lt c set var METODO value editarRol gt lt c if gt lt display table name items id item class esmena requestURI ACCION do method listarRoles style width 100 sort list pagesize 100 defaultorder ascending defaultsort 2 export excel gt display column title Escoger style text align center gt lt input type radio name id rol value item id checked checked gt lt input gt lt display column gt lt display column property id title C amp oacute digo style text align left white space nowrap maxLength 40 gt lt display column title Nombre sortable true style text align left white space nowrap maxLength 40 gt lt c if test param id usuario null gt lt a href co
42. width 800 status yes resizable yes toolbar no menubar no scrollbars yes location no if popup popup focus property gt lt bean message key web ui boton crear gt lt html button gt lt td gt lt td width 1 gt lt c if test not empty menu menus gt lt td align right gt lt html submit styleClass button onclick this form method value quitarSubMenu bean messagekey web ui boton quitar gt lt bean message key web ui boton quitar gt lt html button gt lt td gt 95 html submit lt td gt lt td width 1 gt lt c if gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt display table name menu menus id item class esmena requestURI ACCION do method editarMenu style width 100 sort list pagesize 100 defaultorder ascending defaultsort 2 export true gt display column title Escoger style text align center gt lt input type radio name id_menu value item id checked checked gt lt input gt lt display column gt display column property id title C amp oacute digo style text align left white space nowrap maxLength 40 gt lt display column property nombre title Nombre sortable true style text align left white space nowrap maxLength 40 gt lt display column property url title Url style text align left white space nowrap maxLength 40 gt lt d
43. 00 sort list pagesize 100 defaultorder ascending defaultsort 3 export false gt display setProperty name paging banner all items found value gt display setProperty name paging banner page link value gt display setProperty name basic msg empty_list value gt lt display setProperty name paging banner full value gt lt display setProperty name paging banner first value gt display setProperty name paging banner last value gt lt display setProperty name paging banner page selected value gt lt c forEach items rol menus var menu1 gt cif test menu id menut id gt lt display column property nombre title Nombre style text align left white space nowrap maxLength 15 gt lt display column property url title URL style text align left white space nowrap maxLength 40 gt lt display column property orden title Orden style text align center white space nowrap gt lt display column title Quitar style text align center white space nowrap gt lt input type checkbox value menu id name id_sub_menu_rol onclick location href 99 contextPath security do method quitarSubmenuRol amp id_rol rol id amp id_sub_menu_rol menu id gt lt display column gt lt c if gt lt c forEach gt lt display table gt lt c if gt lt display column gt lt display table gt lt td gt lt tr gt lt html form gt
44. ACCION EXITOSA usuario getNombre return mapping findForward logoff else manager guardarObjeto usuario msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE TRANSACCION EXITOSA usuario getNombre jelse msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR EI nombre de usuario usuario getld ya se encuentra asignado Por favor ingrese otro jelse msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR La clave y su confirmaci n tienen que ser iguales saveMessages request msg request setAttribute usuario usuario String isCambio String request getSession getAttribute Usuario CLAVE CAMBIADA if isCambio null amp amp isCambio compareTo Usuario INICIAL 0 return mapping findForward cambioClave return mapping findForward editarUsuario public ActionForward listarRoles ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION 73 String id_usuario request getParameter id_usuario System out printIn id_usuario DynaActionForm dynaForm DynaActionForm form String textToFind String dynaForm get textToFind String cm
45. ACTIVO Roles asignados Agregar Quitar Encontrados 2 registros mostrando todos los registros P g 1 Escoger C digo Nombre o 2 Admmatacin de Seguridad Mantenimiento de usuarios roles y menus 10403 ALUMNO ROL ALUMNO Opciones de Exportaci n CSV Excel XML saf Fig 2 8 4 Asignar un Rol a un Usuario 2 1 2 Mantenimiento de Roles En esta pantalla se muestran las diversas opciones en que podemos realizar las consultas de roles creaciones y asignaciones a los usuarios los cuales pueden ser las siguientes bh Listar todos los roles 2 Listar roles por el estado A l 3 Listar roles por Nombre 4 Listar roles por la Descripci n 5 Creaci n de un Rol 6 Asignar un menu a un Rol 12 Usuario ADMIN Sali ACADEMICO Consulta de Roles Administrar Seguridad Criterios de B squeda Mantenimiento de Usuarios Mantenimiento de Roles Mantenimiento de Menus Estado TON v O Todos Fig 2 9 Mantenimiento de Roles 2 1 2 1 Listar todos los Roles Esta consulta puede ser masiva sin filtros listando todos los roles que se encuentran almacenados en el sistema Usuario ADMIN Sali ACADEMICO Consulta de Roles Consultar Agregar Administrar Seguridad Criterios de B squeda Mantenimiento de Usuarios o EA Mantenimiento de Roles gas Descppcon Mantenimiento de Menus Estado Todos v Resultado Encontrados 5 registros mostrando todos los registros P g 1 Escoger C digo Nombre Descripci n 1 Usuario In
46. CCION SECURITY ACCION String id rol request getParameter id rol ActionMessages msg new ActionErrors if id rol null amp amp id rol length gt 0 String id menu request getParameter id sub menu rol if id menu null amp amp id menu length gt 0 Rol rol manager findRolWithMenus id rol Menu menu null for Iterator iter rol getMenus iterator iter hasNext Menu menu2 Menu iter next if menu2 getld compareTo Long valueOf id menu 0 menu menu2 break if menu null amp amp rol getMenus contains menu rol getMenus remove menu for Iterator iter menu getMenus iterator iter hasNext Menu menu2 Menu iter next Menu menus null for Iterator iterator rol getMenus iterator iterator hasNext menu3 Menu iterator next if menu2 getld compareTo menu3 getld 0 break else menus null if menu3 null amp amp rol getMenus contains menu3 rol getMenus remove menu2 manager guardarObjeto rol msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP_MENSAJE_TRANSACCION_EXITOSA rol getNombre menu getNombre else 78 msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP_MENSAJE_ERROR Escoja un menu para asignarlo al rol else msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR Escoja un rol
47. DaoSupport import com bvg comun persistencia Eliminable import com bvg comun security model auth Menu import com bvg comun security model auth Rol import com bvg comun security model auth Usuario public class ComunDAO Hibernate extends HibernateDaoSupport implements ComunDAO public void guardarObjeto Object objeto throws DataAccessExceptionf getHibernateTemplate saveOrUpdate objeto public void borrarObjeto Object objeto throws DataAccessException getHibernateTemplate delete objeto 29 Procedimientos Generales para listar los menues usurios y roles con sus respectivas validaciones public List getMenus HashMap filtros throws DataAccessExceptionf List result null StringBuffer query new StringBuffer from Menu o query append left outer join fetch o menus as submenu result getHibernateTemplate find query toString order by o nombre return result public List getUsuarios HashMap filtros List result null StringBuffer query new StringBuffer from Usuario o result getHibernateTemplate find query toString order by o id return result public List getRoles HashMap filtros List result null StringBuffer query new StringBuffer from Rol o result getHibernateT emplate find query toString order by o id return result Llamada a Procedimientos Particulares para buscar un usuario un usuario asociado a un rol un rol asociado a un m
48. ESSAGE new ActionMessage Mensajes APP MENSAJE ERROR El menu ya ha sido asignado a este rol anteriormente else msg add ActionMessages GLOBAL MESSAGE new 83 ActionMessage Mensajes APP MENSAJE ERROR No se puede quitar el menu que esta editando rid menu padre else msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR Escoja un submenu para asignarlo al menu else msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR Escoja un menu para agregar un submenu saveMessages request msg return editarMenu mapping form request response public ActionForward guardarMenu ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 f request getSession setAttribute ACCION SECURITY ACCION DynaActionForm dynaForm DynaActionForm form Menu entidad Menu dynaForm get menu ActionMessages msg new ActionErrors String idPadre request getParameter menu idPadre if idPadre null idPadre null amp amp idPadre length O entidad setldPadre null if entidad getld null amp amp entidad getldPadre null amp amp entidad getld compareTo entidad getldPadre 0 msg add ActionMessages GLOBAL MESSAGE new Acti
49. INDICE GENERAL MANUALES CAPITULO 1 1 INGRESO AL SISTEMA 1 1 Autentificaci n de Usuario 1 2 Error de Autentificaci n 1 3 Clave no valida 1 4 Usuario no Registrado 1 5 Clave de usuario errada CAPITULO 2 2 OPCIONES DEL MEN PRINCIPAL DEL ADMINISTRADOR DE SISTEMA 2 1 Men Principal 2 1 1 Mantenimiento de Usuarios 2 1 1 1 Listar Todos los Usuarios del Sistema 2 1 1 2 Listar Usuarios por Estado 2 1 1 3 Listar Usuarios por Nombre 2 1 1 4 Listar por Usuario de Ingreso 2 1 1 5 Creaci n de un Usuario 2 1 1 6 Asignar un Rol a un Usuario 2 1 2 Mantenimiento de Roles 2 1 2 1 Listar todos los Roles 2 1 2 2 Listar de Roles por el Estado 2 1 2 4 Listar Roles por la Descripci n 2 1 2 5 Creaci n de un Rol 2 1 2 6 Asignar un Menu a un Rol 2 1 3 Mantenimiento de Menus 2 1 3 2 Listar los menus por Nombre 2 3 1 3 Listar menus por url requerido 2 1 3 4 Listar por menus mostrables o no 2 3 1 5 Listar menus por estado 2 3 1 6 Listar los menus por agrupados o no agrupados 2 3 1 7 Creaci n de un nuevo Menu 2 3 1 8 Creaci n de un Submenu CAPITULO 3 3 MANUAL TECNICO 12 12 13 14 15 17 18 19 19 20 21 21 23 26 26 MANUAL DE USUARIO CAPITULO 1 1 INGRESO AL SISTEMA ACADEMICO 1 1 Autentificacion de Usuario En esta pantalla procedemos a ingresar el usuario ya sea este coordinador profesor alumno o administrador del sistema asi mismo se ingresara la clave para
50. M lwebjjsp securitybuscar menujsp webjsp securitybuscar_empleado jsp webjsp securitybuscar_roljsp 28 ComunDao java package com bvg comun model dao import java util HashMap import java util List import org springframework dao DataAccessException import com bvg comun security model auth Menu import com bvg comun security model auth Rol import com bvg comun security model auth Usuario public interface ComunDAO public void guardarObjeto Object objeto throws DataAccessException public void borrarObjeto Object objeto throws DataAccessException Llamada a Procedimientos Generales para enlistar los menues usuarios y roles public List getMenus HashMap filtros throws DataAccessException public List getUsuarios HashMap filtros public List getRoles HashMap filtros Llamada a Procedimientos Particulares para buscar un usuario un usuario asociado a un rol un rol asociado a un menu y un menu public Usuario findUsuarioByld String string throws DataAccessException public Usuario findUsuarioByldWhithRoles String usuarioLogin throws DataAccessException public Rol findRolWithMenus Long id throws DataAccessException public Menu findMenuByld Long id ComunDAOhibernate java package com bvg comun model dao import java util HashMap import java util Iterator import java util List import org springframework dao DataAccessException import org springframework orm hibernate3 support Hibernate
51. OGIN private static final String LOG OFF URL logoff jsp private static final String ACTION URI jj security check private static final String ROOT URI private static final String WIDTHOUT PERMISSIONS No tiene el suficiente nivel de acceso a este recurso private static final String LOG IN URL login jsp public void init FilterConfig filterConfig throws ServletException this filterConfig filterConfig loginAuthorizationParam filterConfig getlnitParameter LOGIN AUTHORIZATION PARAM loginGuestUser 57 filterConfig getlnitParameter LOGIN USUARIO INVITADO PARAM urlPatternFactory new URLPatternFactory public void doFilter ServietRequest req ServletResponse res FilterChain chain throws IOException ServletException HttpServletRequest request HttpServletRequest req HttpServletResponse response HttpServletResponse res String uri request getRequestURI substring request getContextPath length Collection opcionesInvitado null if request getSession getAttribute opInvitado null opcionesInvitado getLoginAuthorization getOpciones loginGuestUser request getSession setAttribute oplInvitado opcioneslnvitado jelse opcioneslInvitado Collection request getSession getAttribute opInvitado for Iterator iter opcionesInvitado iterator iter hasNext CredencialAcceso credencial CredencialAcceso iter next if matchURL credencial
52. UnsupportedEncodingException import java security MessageDigest import java security NoSuchAlgorithmException import sun misc BASE64Encoder public class SHA1BASE64 public static String encriptar String textoplano throws IllegalStateException MessageDigest md null try md MessageDigest getInstance SHA Instancia de generador SHA 1 catch NoSuchAlgorithmException e throw new lllegalStateException e getMessage try md update textoplano getBytes UTF 8 Generacion de resumen de mensaje catch UnsupportedEncodingException e throw new lllegalStateException e getMessage byte raw md digest Obtencion del resumen de mensaje String hash new BASE64Encoder encode raw Traduccion a BASE64 return hash UsuarioLogin java Interface de login package com bvg comun security util import java util Collection public interface UsuarioLogin Devuelve el login de un usuario public String getLoginName Valida el password de un usuario public boolean validaPassword String intento Indica si el usuario esta activo public boolean isActivo Devuelve las credenciales 54 public Collection getCredenciales SecurityDAO java package com bvg comun security import org springframework dao DataAccessException import com bvg comun security model auth Usuario import com bvg comun security util LoginAuthorization public interface Security DAO extends LoginAuthorization
53. VO A public static final String ESTADO_INACTIVO I Propiedad de la Tecnologia Hibernate permite eliminar o no un objeto acuerdo al estado public String getEstado public void setEstado String activo Entidad java Clase que hereda todos los String package com bvg comun persistencia public abstract class Entidad protected Long id public Entidad El parametro id de una entidad debe ser implementado por cada clase public abstract Long getld public void setld Long id this id id public boolean isNew return this id null public String toString if id null return id toString else return this getClass getName de 3l 32 EntidadAuditable java Propiedades de Hibernate que permite Auditar o no un usuario como la fecha de ingreso fecha de modificacion etc package com bvg comun persistencia import java util Date import com bvg comun security model auth Usuario public abstract class EntidadAuditable extends Entidad implements Auditable protected Date fechaModificacion protected Date fechalngreso protected Usuario usuariolngreso protected Usuario usuarioModificacion public Date getFechalngreso return this fechalngreso public void setFechalngreso Date fecha this fechalngreso fecha public Date getFechaModificacion return this fechaModificacion public void setFechaModificacion Date fecha this fechaModificacion fecha
54. _no_borde width 90 gt lt bean message key web ui usuario roles gt lt td gt lt td align right gt lt html button styleClass button onclick var popup window open contextPath security do method listarRoles amp id_usuario usuario id popup height 400 width 800 status yes resizable yes toolbar no menubar no scrollbars yes location no if popup popup focus property gt lt bean message key web ui boton crear gt lt html button gt lt td gt lt td width 1 gt lt c if test not empty usuario roles gt lt td align right gt lt html submit styleClass button onclick this form method value quitarRol gt lt bean message key web ui boton quitar gt lt html submit gt lt td gt lt td width 1 gt lt c if gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt display table name usuario roles id item class esmena requestURI ACCION do method editarUsuario style width 100 sort list pagesize 100 defaultorder ascending defaultsort 2 export true gt display column title Escoger style text align center gt lt input type radio name id_rol value item id checked checked gt lt input gt lt display column gt lt display column property id title C amp oacute digo style text align left white space nowrap maxLength 40 gt lt display column property nombre title N
55. a O Todos O Descripci n COORDINADOR Estado AcTVO iv Resultado Encontrados 5 registros mostrando todos los registros Pag 1 Escoger Codigo Nombre Descripci n O 10808 COORDINADOR ROL COORDINADOR Fig 2 12 Listar Roles por Nombre 2 1 2 4 Listar Roles por la Descripci n En esta consulta los roles pueden ser listados poniendo una descripci n del rol o roles a consultar 14 Usuario ADMIN X Sali Consulta de Roles Administrar Seguridad Criterios de B squeda Mantenimiento de Usuarios Mantenimiento de Roles O Todos Deep mutado Mantenimiento de Menus Estado ACTIVO ACADEMICO Resultado Encontrados 5 registros mostrando todos los registros P g 1 Codil Nombre Descripci n O 1 Usuario Invitado Opciones de invitado Fig 2 13 Listar Roles por la Descripci n 2 1 2 5 Creaci n de un Rol En la figura 2 8 al dar clic en el bot n Agregar nos aparece la siguiente pantalla en la cual se debe ingresar el nombre del Rol la descripci n y el estado del mismo Usuario ADMIN ESO ACADEMICO Informaci n del Rol Administrar Seguridad Datos del Rol Microsoft Internet Explorer Mantenimiento de Usuarios ul Mantenimiento de Roles Nombre del Rol ROL PROFESOR Mantenimiento de Menus Descripci n del Rol ROL PROFESOR Estado ACTIVO v Menus asignados No existen registros para mostrar Fig 2 14 Creaci n de un Rol Enseguida se debe presionar el bot n Grabar y aparece
56. administrador de servicios lt if exception null gt lt div bgcolor white width 90 gt lt pre gt lt small gt lt exception printStackTrace new java io PrintWriter out gt lt small gt lt pre gt lt div gt lt else gt lt bean message key app error contact gt lt gt lt td gt lt td width 2px gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td height 10 gt lt tr gt lt table gt lt table align center gt lt tr gt lt td colspan 3 gt lt div id legal popup align center gt lt span class copyright gt amp copy Sistema de Administraci amp oacute n Acad amp eacute mica lt span gt lt div gt lt td gt lt tr gt lt table gt lt body gt lt html gt botones jsp lt include file web jsp include taglibs jsp gt lt c if test not empty botones gt 89 lt table border 0 gt lt tr style text align center gt lt c forEach items botones var boton gt lt td style text align center gt lt c choose gt lt c when test boton conFormulario gt c set var target value iFrameDetalle gt lt c if test not empty boton target gt lt c set var target value boton target gt lt c if gt lt html form action boton accion target target gt lt html hidden property method value boton metodo gt lt html submit styleClass button onclick this form method value boto
57. alidator name date classname org apache struts validator FieldChecks method validateDate methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends msg errors date jsFunctionName DateValidations 5 lt validator name intRange classname org apache struts validator FieldChecks method validatelntRange methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends integer msg errors range gt lt validator name floatRange classname org apache struts validator FieldChecks method validateFloatRange methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends float msg errors range gt lt validator name doubleRange classname org apache struts validator FieldChecks method validateDoubleRange methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org
58. ar_persona jsp gt Usuarios forward name listarUsuarios path web jsp security listar_usuarios jsp gt lt forward name editarUsuario path web jsp security editar_usuario jsp gt forward name buscarEmpleado pathz web jsp security buscar empleado jsp gt forward name buscarRol pathz web jsp security buscar rol jsp gt Roles forward name listarRoles path web jsp security listar_roles jsp gt lt forward name editarRol path web jsp security editar_rol jsp gt lt forward name buscarMenu path web jsp security ouscar_menu jsp gt Menus forward name listarMenus path web jsp security listar_menus jsp gt lt forward name editarMenu path web jsp security editar_menu jsp gt forward name cambioClave path web jsp security cambio_clave jsp gt forward name olvidoClave path web jsp security olvido_clave jsp gt lt action gt lt action mappings gt Message Resources Definitions message resources parameter messages Plug Ins Configuration plug in className org springframework web struts ContextLoaderPlugIn gt lt set property property contextConfigLocation value WEB INF applicationContext xml WEB INF action servlet xml lt plug in gt plug in className org apache struts validator ValidatorPlugIn gt lt set property property pathnames value WEB INF validator rules xml WEB INF validation xml gt 117 lt plug in gt
59. ate3 support HibernateDaoSupport import com bvg comun persistencia Eliminable import com bvg comun security Security DAO import com bvg comun security model auth Log import com bvg comun security model auth Menu import com bvg comun security model auth Rol import com bvg comun security model auth Usuario import com bvg comun security util UsuarioLogin public class Securitylmpl extends HibernateDaoSupport implements SecurityDAO public Usuario findUsuario String usrLogin throws DataAccessException List lista lista getHibernateTemplate find from Usuario usr if lista size gt O for Iterator iter lista iterator iter hasNext Usuario usuario Usuario iter next if usuario getld compareTo usrLogin 0 amp amp usuario getEstado compareTo Eliminable ESTADO_ACTIVO 0 return usuario return null public UsuarioLogin getUsuario String userlogin return findUsuario userlogin public Menu getOpcion String id_opcion return Menu getHibernateTemplate get Menu class Integer valueOf id_opcion public List getOpciones String userlogin List lista getHibernateTemplate find from Usuario user left outer join fetch user roles List result new ArrayList if lista null amp amp lista size gt 0 List roles getHibernateTemplate find from Rol rol left outer join fetch rol menus if roles null amp amp roles size gt 0 for
60. bTextToFind String dynaForm get cmbTextToFind String cmbEstado String dynaForm get cmbEstado List items null HashMap filtros new HashMap List result new ArrayList if cmbTextToFind null amp amp cmbTextToFind length gt 0 if cmbTextToFind compareTo NOMBRE 0 48 textToFind null amp amp textToFind length gt 0 filtros put nombre like textToFind toUpperCase trim if cmb TextToFind compareTo DESCRIPCION 0 amp amp textToFind null amp amp textToFind length gt 0 filtros put descripcion like textToFind if cmbEstado null amp amp cmbEstado length gt O amp amp cmbEstado compareTo TODOS 0 filtros put estado cmbEstado items manager getRoles filtros for Iterator iter items iterator iter hasNext Rol rol Rol iter next boolean sw false if CmbTextToFind compareTo NOMBRE 0 amp amp textToFind null amp amp textToFind length gt 0 if rol getNombre toUpperCase trim indexOf textToFind toUpperCase trim 1 sw true if cmb TextToFind compareTo DESCRIPCION 0 amp amp textToFind l null amp amp textToFind length gt 0 if rol getDescripcion toUpperCase trim indexOf textT oFind toUpperCase trim 1 sw true if cmbEstado null 44 cmbEstado length gt 0 amp amp cmbEstado compareTo TODOS 0 if
61. boton eliminar public static final String WEB Ul BOTON BUSCAR web ui boton buscar public static final String WEB Ul BOTON BUSQUEDA AVANZADA web ui boton busqueda avanzada public Mensajes super GlobalAction java package com bvg comun web import java lang reflect Method import java util ArrayList import java util Collections import java util Iterator import java util List import javax servlet http HttpServletRequest import javax servlet http HttpServletResponse import org apache struts action ActionForm import org apache struts action ActionForward import org apache struts action ActionMapping import org apache struts actions DispatchAction import com bvg comun persistencia Eliminable import com bvg comun security model auth Menu import com bvg comun security model auth Rol import com bvg comun security model auth Usuario import com bvg comun security util UsuarioLogin import com bvg comun web security SecurityFilter import com bvg security service ModelManager public class GlobalAction extends DispatchAction Deficiones de atributos para generar acciones dinamicas en las paginas jsp s public static final String ACCION ACCION public static final String METODO METODO public static final String PARAMETROS PARAMETROS URL de la acci n de struts public static final String GLOBAL_ACCION global Nombre del parametro de URL con el m todo a ejecutar en segunda in
62. c void setUrl String url this url url public Usuario getUsuario return usuario public void setUsuario Usuario usuario this usuario usuario public String getAddr return addr public void setAddr String addr this addr addr 37 public String getUser return user public void setUser String user this user user Menu hbm xml Mapeo tabla MENU hibernate mapping gt lt class name com bvg comun security model auth Menu table MENU gt lt id name id column codigomenu type java lang Long gt lt generator class hilo gt lt param name table gt UID lt param gt lt param name column gt codigomenu lt param gt lt param name max_lo gt 100 lt param gt lt generator gt lt id gt lt property name url type java lang String update true insert true column url not null true l gt lt property name estado type java lang String update true insert true column estado not null true l gt lt property name orden type java lang Integer update true insert true column orden not null true l gt 38 lt property name idPadre type java lang Long update true insert true column codigomenupadre l gt lt property name nombre type java lang String update true insert true column nombre not null true l gt lt set name menus lazy false inverse true cascade
63. che commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends msg errors integer jsFunctionName IntegerValidations 5 lt validator name long classname org apache struts validator FieldChecks method validateLong methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends msg errors long gt lt validator name float classname org apache struts validator FieldChecks method validateFloat methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends msg errors float jsFunctionName FloatValidations gt lt validator name double classname org apache struts validator FieldChecks method validateDouble methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field 121 org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends msg errors double gt lt v
64. clude file web jsp include taglibs jsp gt lt script type text javascript gt function cdd menu647682Q lllllMIIMIIMIIilistar Menu Data PIITIMMTTHTTEH T TI 128 Unique Menu Id this uid 647682 JERAR EASE RARER ERASER ii KAI LEEEE EEE EE ELER ER ERE EAEAERAR ESS EREEAESE RARE EEA LEERY Icon Images REALE EAELESE LEREEAEES HERES SAFAR K KAKAK EER ERAKEE LEER ELE AALS HEREEE AER NE RENESAS RARER ERE eic EY Absolute positioned icon images x y positioned this abs icon image0 default icon gif this abs icon rollover0 default icon gif this abs icon image wh0 7 7 this abs icon image xyO 12 6 this abs icon image1 main divider gif this abs icon rollover1 main divider gif this abs icon image wh1 153 1 this abs icon image xy1 155 2 ii Global Menu Container Settings AA ARA this menu_background_color D5E2F1 this menu_border_color D5E2F1 this menu border width 1 this menu padding 2 2 2 2 this menu border style solid this divider caps false this divider width 0 this divider height 0 this divider background color 6F9CCE this divider border style none this divider border width 0 this divider border color D5E2F1 this menu is horizontal false this menu width 100 this menu xy 14 19 NS Global Menu Item Settings AA IRI III IID IID II I OHER II II III III IIIA this menu_items_background_color_roll 6F9CCE this menu items text c
65. de acci n o permiso el orden o nivel mostrabilidad y el estado de dicho men 22 Usuario ADMIN XX Sali ACADEMICO Informaci n del Men Administrar Seguridad Datos de acceso y control Mantenimiento de Usuarios E Mantenimiento de Roles Nombre del Men Mantenimiento de Menus Ment Padre Buscar Quitar Url de Acci n o Permiso Orden Mostrable SI w Estado ACTVO v Fig 2 23 1 Creaci n de un nuevo Menu El men padre se llena cuando estemos creando un submenu En este caso estamos creando un menu padre este campo se deja vacio y el orden o nivel es O cero El url o permiso se debe llenar con los actions de validaci n Usuario ADMIN X Sali Informaci n del Men Administrar Seguridad Mantenimiento de Usuarios Mantenimiento de Roles Nombre del Men Opciones del Alumno Mantenimiento de Menus Datos de acceso y control Men Padre Url de Acci n o Permiso web jsp alumno Orden o Mostrable S v Fig 2 23 2 Creaci n de un nuevo Ment AL presionar el bot n grabar nos aparece un mensaje de que la grabaci n a la base fue exitosa luego presionamos aceptar 23 Usuario ADMIN Sali ACADEMICO Informaci n del Menu Administrar Seguridad Mantenimiento de Usuarios Mantenimiento de Roles Nombre del Men Opciones del Alumno Mantenimiento de Menus Datos de acceso y control Sub menus asignados No existen registros para mostrar Fig
66. debe ser de tipo real errors date 0 no es una fecha errors range 0 no est en el rango desde 1 hasta 2 errors creditcard 0 no es una tarjeta de cr dito v lida errors email 0 no es una direcci n de correo electr nico v lida 404 jsp lt page language java 96 lt taglib uri http jakarta apache org struts tags bean prefix bean gt lt html gt lt head gt lt include file web jsp include include jsp gt lt head gt lt body gt lt table width 100 border 0 cellspacing 0 cellpadding 0 gt lt tr gt lt td gt lt div id line_logo gt lt table width 100 border 0 gt lt tr gt lt td width 38 gt lt img src web img logo gif gt lt td gt lt td width 100 gt lt span class texto_left gt lt bean message key web ui titulo gt lt span gt lt td gt lt tr gt lt table gt lt div gt lt td gt lt tr gt lt tr gt lt td bgcolor 285577 height 1 gt lt tr gt lt tr gt lt td align right gt lt div id line_cerrar gt lt a href onclick window close class mhTextEmph gt Cerrar lt a gt lt div gt lt td gt lt tr gt lt tr gt lt td height 10 gt lt tr gt lt tr gt lt td class nombre_azul gt Informaci amp oacute n no disponible lt td gt lt tr gt lt tr gt lt td height 5 gt lt tr gt lt tr gt lt td gt lt table cellspacing 0 cellpadding 0 border 0 width 100 gt lt tr gt lt td width 2px gt
67. dth 100 border 0 gt lt tr gt lt td class cab_tabla_no_borde width 90 gt lt bean message key web ui usuario consultar gt lt td gt lt td align right gt html submit styleClass button onclick this form method value listarUsuarios key web ui boton consultar gt lt html submit gt lt td gt lt td width 1 gt lt td align right gt html button styleClass button onclick location href contextPath security do method editarUsuario property gt lt bean message key web ui boton crear gt lt html button gt lt td gt lt td width 1 gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla colspan 7 width 100 gt lt bean message key web ui criterios gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt html radio property cmbTextToFind value TODOS gt lt bean message key web ui todos gt lt html radio gt lt td gt lt td class cab_form gt lt html radio property cmbTextToFind value NOMBRE gt lt bean message key web ui nombre gt lt html radio gt lt td gt lt td class cab form gt lt html radio property cmbTextToFind value USUARIO gt lt bean message key web ui usuario gt lt html radio gt lt td gt lt td class det_form width 20 gt html text property textToFind size 30 maxlength 30 gt
68. e break if sw rol getMenus add menu2 manager guardarObjeto rol msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE TRANSACCION EXITOSA rol getNombre menu getNombre else msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR El menu ya ha sido asignado a este rol anteriormente else msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP_MENSAJE_ERROR Escoja un menu para asignarlo al rol 76 else msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR Escoja un rol para agregar un menu saveMessages request msg return editarRol mapping form request response public ActionForward quitarMenu ActionMapping mapping ActionForm form HttpServlet Requestrequest HttpServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION String id rol request getParameter id rol ActionMessages msg new ActionErrors if id rol null amp amp id rol length gt 0 String id menu request getParameter id menu if id menu null amp amp id menu length gt 0 Rol rol manager findRolWithMenus id rol Menu menu null for Iterator iter rol getMenus iterator iter hasNext M
69. e Alumnos webljsp Opciones del Alumno Ingreso de activo homo Modificacion del Alumno activo Opciones de Exportaci n CSV Excel XML Fig 2 24 4 Visualizaci n Creaci n de un Ment y sus respectivos Subments MANUAL TECNICO Estructura del Proyecto RE E Od Gl au Academico seguridad 9 Application Sources 3 99 com bvg comun model 9 dao E ComunDAO java El ComunDAOHibernate java 3 49 persistencia i E Auditable java Z Eliminable java Entidad java E E EntidadAuditable java ES ES EntidadAuditableEliminable java EntidadEliminable java d IE EntidadNatural java m security cp dao E SecurityImpl jawa 2 9 model auth i el GePersona hbm xml el Log hbm xml Log java Menu hbm xml Menu java Persona hbm xml Persona java Rol hbm xml Rol java Usuario hbm xml Usuario java ENENENPEE m util a matcher i E URLPattern java i URLPatternFactory java En URLPatternMatcher java E Credencialacceso java H En Login4uthorization java sHA1BASE64 java ll UsuarioLogin jawa amp SecurityDAO java m m service i En ComunManager java E ComunModelManager java m util 5 FechaFormat java m web gt security EH SecurityFilter java m m ui Ss Mensajes java 5 GlobalAction java 2 9 com bvg security service i E Manager java E ModelManager java m web En Security Act
70. ending defaultsort 2 export false gt display column title Escoger style text align center gt lt input type radio name id_usuario value item id checked checked gt lt input gt lt display column gt lt display column title Nombre sortable true style text align left white space nowrap maxLength 40 gt lt a href contextPath ACCION do method METODO amp id_usuario gt lt bean message 111 item id gt item nombre lt a gt lt display column gt lt display column property id title Usuario style text align left white space nowrap maxLength 40 gt lt display column title Fecha de Creaci amp oacute n style text align center white space nowrap maxLength 40 gt lt fmt formatDate value item fechaSolicitud pattern datePattern gt lt display column gt display column title Estado style text align center white space nowrap gt lt c if test item estado A bean message key web ui eliminable estado activo gt lt c if gt lt c if test item estado l bean message key web ui eliminable estado inactivo gt lt c if gt lt display column gt lt display table gt lt td gt lt tr gt lt c if gt lt html form gt lt table gt lt body gt lt html gt olvido_clave jsp lt include file web jsp include taglibs jsp gt lt html gt lt head gt lt include file web jsp include include jsp 96 lt
71. enu menu2 Menu iter next if menu2 getld compareTo Long valueOf id menu 0 menu menu2 break if menu null amp amp rol getMenus contains menu rol getMenus remove menu for Iterator iter menu getMenus iterator iter hasNext Menu menu2 Menu iter next Menu menus null for Iterator iterator rol getMenus iterator iterator hasNext menu3 Menu iterator next if menu2 getld compareTo menu3 getld 0 break else menus null if menu3 null amp amp rol getMenus contains menu3 rol getMenus remove menu2 manager guardarObjeto rol msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP_MENSAJE_TRANSACCION_EXITOSA rol getNombre menu getNombre else msg add ActionMessages GLOBAL_MESSAGE newActionMessage Mensajes APP MENSAJE ERROR Escoja un menu para asignarlo al rol 77 else msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR Escoja un rol para agregar un menu saveMessages request msg return editarRol mapping form request response public ActionForward quitarSubmenuRol ActionMapping mapping ActionForm form HttpServletRequest request HtipServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute A
72. enu y un menu public Usuario findUsuarioByld String id throws DataAccessException StringBuffer query new StringBuffer from Usuario o query append left outer join fetch o roles List result getHibernate Template find query toString if result null amp amp result size gt O for Iterator iter result iterator iter hasNext Usuario usuario Usuario iter next if usuario getld compareTo id 0 return usuario return null public Usuario findUsuarioByldWhithRoles String usuarioLogin throws DataAccessExceptionf List lista getHibernateTemplate find from Usuario user left outer join fetch user roles if lista null amp amp lista size gt 0 for Iterator iter lista iterator iter hasNext Usuario usuario Usuario iter next if usuario getld compareTo usuarioLogin 0 amp amp usuario getEstado compareTo Eliminable ESTADO ACTIVO 0 for Iterator iterator usuario getRoles iterator iterator hasNext Rol rol Rol iterator next System out printin rol getDescripcion if rol getEstado compareTo Eliminable ESTADO_ACTIVO 0 30 for Iterator iterator3 rol getMenus iterator iterator3 hasNext Menu menu Menu iterator3 next System out printIn menu getUrl System out printin usuario getPersona return usuario return null public Rol findRolWithMenus Long id throws DataAccessE
73. eout gt 5 lt session timeout gt lt session config gt lt mime mapping gt lt extension gt html lt extension gt lt mime type gt text html lt mime type gt lt mime mapping gt lt mime mapping gt lt extension gt txt lt extension gt lt mime type gt text plain lt mime type gt lt mime mapping gt lt jsp config gt lt taglib gt lt taglib uri gt http displaytag sf net lt taglib uri gt lt taglib location gt WEB INF tld displaytag tld lt taglib location gt lt taglib gt lt taglib gt 124 lt taglib uri gt http jakarta apache org struts tags html lt taglib uri gt lt taglib location gt WEB INF tld struts html tld lt taglib location gt lt taglib gt lt taglib gt lt taglib uri gt http jakarta apache org struts tags bean lt taglib uri gt lt taglib location gt WEB INF tld struts bean tld lt taglib location gt lt taglib gt lt taglib gt lt taglib uri gt http java sun com jsp jstl core lt taglib uri gt lt taglib location gt WEB INF tld c tld lt taglib location gt lt taglib gt lt taglib gt lt taglib uri gt http java sun com jsp jstl fmt lt taglib uri gt lt taglib location gt WEB INF tld fmt tld lt taglib location gt lt taglib gt lt taglib gt lt taglib uri gt http jakarta apache org taglibs string 1 1 lt taglib uri gt lt taglib location gt WEB INF tld taglibs string tld lt taglib location gt lt taglib gt lt jsp config gt lt welcome file li
74. es GLOBAL_MESSAGE new ActionMessage Mensajes APP_MENSAJE_TRANSACCION _EXITOSA Solo se permite un nivel de menus El menu que esta agregando tiene asignados submenus else menuPadre getMenus add menu manager guardarObjeto menuPadre menu setldPadre menuPadre getld manager guardarObjeto menu msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE TRANSACCION EXITOSA menuPadre getNombre menu getNombre DynaActionForm dynaForm DynaActionForm form dynaForm set menu menuPadre request setAttribute menu menuPadre saveMessages request msg return mapping findForward editarMenu else msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP_MENSAJE_ERROR El menu ya ha sido asignado a este rol anteriormente else msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR No se debe asignar el mismo menu como padre id menu padre else msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR Escoja un submenu para asignarlo al menu else msg add ActionMessages GLOBAL_MESSAGE new 82 ActionMessage Mensajes APP MENSAJE ERROR Escoja un menu para agregar un submenu saveMessages request msg return editarMenu mapping form request response public ActionForward quitarSubMenu ActionMapping mapping ActionForm form HttpServletRequest request Htt
75. est getContextPath request setAttribute sessid request getSession getld gt lt tr gt lt td colspan 2 align right gt lt input value Ingresar name submit type submit gt lt br gt lt a href onclick if document all j_u value location href contextPath security do methodzolvidoClave amp isOlvido sessid amp j u document all _u valuejelsefalert Ingrese el usuario Olvido su clave lt a gt lt td gt lt tr gt lt table gt lt form gt lt script language javascript gt document forms 0 j u focus lt script gt lt hr gt lt table style width 100 gt lt tr gt lt td gt lt A href lt c url value gt gt Inicio lt A gt lt td gt lt td style text align right color silver gt ACADEMICO lt td gt lt tr gt lt table gt lt body gt lt html gt Mensajes lt include file web jsp include mensajes jsp gt logoff jsp lt page import javax servlet http Cookie gt lt session invalidate Cookie terminate new Cookie Ultimo_User null terminate setMaxAge 0 response addCookie terminate String cambio de clave String request getAttribute cambio de clave if cambio de clave null 44 cambio de clave compareTo simon 0 cambio de clave Su clave ha sido cambiada tiene que salir del sistema else response sendRedirect request getContextPath gt lt cambio_de_clave gt side_menu jsp lt in
76. extPath LOG OFF URL 59 request getSession setAttribute SESSION_USERLOGIN userLogin request getSession setAttribute SESSION_LOGGED Boolean TRUE if uri indexOf j_security_check html 1 Verificar cambio de clave Usuario usuario Usuario userLogin Date fecha usuario getFechaCambioClave if fecha null fecha usuario getFechaSolicitud Calendar calendar Calendar getInstance calendar setTime fecha calendar set Calendar MONTH calendar get Calendar MONTH 3 if Calendar getlnstance compareTo calendar gt 0 request getSession setAttribute Usuario CLAVE CAMBIADA Usuario INICIAL else if usuario getEstadoCambio compareTo Usuario INICIAL 0 f request getSession setAttribute Usuario CLAVE CAMBIADA Usuario INICIAL response sendRedirect response encodeRedirectURL request getContextPath global do return if last uri null amp amp last uri compareTo logoff uri 0 amp amp last uri compareTo ACTION URI 0 if IrequestRequiresLoggedSession last uri substring request getContextPath length userLogin getLoginName Verificar cambio de clave Usuario usuario Usuario userLogin Date fecha usuario getFechaCambioClave if fecha null fecha usuario getFechaSolicitud Calendar calendar Calendar getInstance calendar setTime fecha calendar set Calendar MONTH calendar get Calendar MONTH 3 if Calendar getI
77. formaci n del Rol Administrar Seguridad Datos del Rol Mantenimiento de Usuarios Mantenimiento de Roles EE SUPER ALUMNO Mantenimiento de Menus Desenpes n del Rel SUR ALUUNO Estado acTVO w Menus asignados K T ado P g 1 Microsoft Internet Explorer Escoger Codigo Nombre Mers Trersecc n Exitosa SUPER ALUMNO Ingreso de Alumnos un New Pattern MenutMostrabic Estado Mastrable MOO prenas 10908 Opcones dei Alumno sweep Fig 2 15 4 Asignaci n de un ment a un Rol 17 Se debe presionar Aceptar y despu s presionar el boton Grabar donde le mostrara la siguiente pantalla que indica que la transacci n fue exitosa Se presiona Aceptar y luego Grabar Informaci n del Rol Administrar Seguridad Datos del Rol z R Un registro encontrado P g 1 Microsoft Internet Fxplorer x Escoger Codigo Nombre Menus Transacci n Dotosa SUPER ALUMNO Bree un New Pattern MeraiMostrabic Estado Mostrable wedgar Opoa wed SpOpcones cei Alman ngrean tane Sel ALimangrese Sue s 1 Apta de Alumncsr os S 10905 Opciones del Ako jwetiso Opcines d jwedjppOpeenes JwebjapiOpeones cel sel te a ds AumnoMogticacica Mt Aumnomostcacon 1 del Alumno del Alumnos Opciones de Exportaci n CSV Excel XML Fig 2 15 5 Asignaci n de un men a un Rol 2 1 3 Mantenimiento de Men s Esta pantalla nos muestra las diferentes formas en que podemos consultar los men s del sistema y a su vez crear submen s e
78. g else request setAttribute SECURITY_MSGLOGIN WIDTHOUT_PERMISSIONS request getRequestDispatcher LOG_IN_URL forward request response return else String param user request getParameter j u String param pass request getParameter j p if param user null LoginAuthorization authorization authorization getLoginAuthorization try UsuarioLogin userLogin userLogin authorization getUsuario param user param user toUpperCase trim if userLogin null getTime po e Usuario no existe request setAttribute SECURITY MSGLOGIN Usuario no registrado en el Sistema request getRequestDispatcher LOG IN URL forward request response else if luserLogin validaPassword param pass Clave invalida String requestURI request getRequestURI String contextPath request getContextPath int result request getRequestUR1 indexOf j security check if result 1 request getSession setAttribute SESSION LAST URI contextPath Jelse request getSession setAttribute SESSION LAST URI requestURI request setAttribute SECURITY MSGLOGIN Contrase a no v lida request getRequestDispatcher LOG IN URL forward request response else Clave correcta String last uri String request getSession getAttribute SESSION LAST URI uri request getRequestURI substring request getContextPath length String logoff uri request getCont
79. getName compareT o metodo trim O return true return false Manager java package com bvg security service import com bvg comun service ComunManager public class Manager extends ComunManager implements ModelManager public Manager super Modelmanager java package com bvg security service import com bvg comun service ComunModelManager public interface ModelManager extends ComunModelManager SecurityAction java Tiene los metodos del struts package com bvg security web import java util ArrayList import java util Calendar import java util Collections import java util HashMap import java util Iterator 66 import java util List import javax servlet http HttpServietRequest import javax servlet http HttpServletResponse import org apache struts action ActionErrors import org apache struts action ActionForm import org apache struts action ActionForward import org apache struts action ActionMapping import org apache struts action ActionMessage import org apache struts action ActionMessages import org apache struts action DynaActionForm import com bvg comun security model auth Menu import com bvg comun security model auth Rol import com bvg comun security model auth Usuario import com bvg comun security util SHA1BASE64 import com bvg comun security util UsuarioLogin import com bvg comun web GlobalAction import com bvg comun web security SecurityFilter i
80. getPattern uri System out printin credencial getPattern chain doFilter request response return Permitido el ingreso del usuario debido a que estoy recuperando la clave String isOlvido request getParameter isOlvido if isOlvido null amp amp isOlvido compareTo request getSession getld 0 chain doFilter request response return Permitido debido a que estoy cambiando la clave String isCambio String request getSession getAttribute Usuario CLAVE CAMBIADA if isCambio null amp amp isCambio compareTo Usuario INICIAL 0 chain doFilter request response return Boolean islogged Boolean request getSession getAttribute SESSION_LOGGED if islogged null amp amp islogged Boolean TRUE UsuarioLogin userLogin UsuarioLogin request getSession getAttribute SecurityFilter SESSION_USERLOGIN if IrequestRequiresLoggedSession uri userLogin getLoginName int result uri indexOf j_security_check if result 1 request getRequestDispatcher request getContextPath forward request response else chain doFilter request response Pass the request response on 58 Log log new Log log setFecha Calendar getlnstance log setHost request getRemoteHost log setAddr request getRemoteAddr log setUser request getRemoteUser log setUrl request getRequestURL toString log setUsuario Usuario userLogin getLoginAuthorization saveLog lo
81. gt lt link type text css rel stylesheet href contextPath web css footer css gt lt link gt lt link type text css rel stylesheet href contextPath web css portal css gt lt link gt lt link type text css rel stylesheet href contextPath web css popup css gt lt link gt 90 COMPONENTE PARA AGREGAR CALENDAR POPUP lt scri pt language JavaScriptsrc contextPath web js calendar popup calendarPop up js gt lt script gt lt script language JavaScript src contextPath web js calendar popup common js gt lt script gt lt script language JavaScript gt document write getCalendarStyles lt script gt mensajes jsp Error Messages lt taglib uri http jakarta apache org struts tags html prefix html gt lt taglib uri http jakarta apache org struts tags bean prefix bean gt lt logic messagesPresent gt lt html messages id error gt script type text javascript gt alert error lt script gt lt html messages gt lt logic messagesPresent gt Success Messages lt logic messagesPresent message true gt lt html messages id message message true gt lt script type text javascript gt alert 5 message lt script gt lt html messages gt lt logic messagesPresent gt pagina_mensajes jsp lt include file web jsp include taglibs jsp gt html lt head gt lt include file web jsp include include jsp gt lt head gt
82. gt lt td width 100 gt lt span class texto_left gt lt bean message key web ui titulo gt lt span gt lt td gt lt tr gt lt table gt lt div gt lt td gt lt tr gt lt tr gt lt td bgcolor 285577 height 1 gt lt tr gt lt tr gt lt td align right gt lt div id line_cerrar gt lt a href onclick window close class mhTextEmph gt Cerrar lt a gt lt div gt lt td gt lt tr gt lt tr gt lt td height 10 gt lt tr gt lt tr gt 88 lt td class nombre_azul gt Informaci amp oacute n no disponible lt td gt lt tr gt lt tr gt lt td height 5 gt lt tr gt lt tr gt lt td gt lt table cellspacing 0 cellpadding 0 border 0 width 100 gt lt tr gt lt td width 2px gt lt td width 110px align center valign top gt lt img src web img advertencia_amarilla png gt lt td gt lt td width 8px gt lt td class descripcion_portada valign top gt Lo sentimos mucho Este servicio no est amp aacute disponible en este momento por favor int amp eacute ntelo m amp aacute s tarde lt br gt lt br gt Por favor comunique este mensaje a su administrador de servicios lt if exception null gt lt blockquote gt lt h6 gt lt exception getMessage gt lt h6 gt lt blockquote gt lt else gt lt bean message key app error contact gt lt 9o br Informaci amp oacute n adicional por favor comun amp iacute quese con su
83. gt lt bean message 110 lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui eliminable estado gt lt td gt lt td class det_form gt lt html select property cmbEstado gt lt html option value TODOS gt lt bean message key web ui todos gt lt html option gt lt html option value A gt lt bean message key web ui eliminable estado activo gt lt html option gt html option value I gt lt bean message key web ui eliminable estado inactivo gt lt html option gt lt html select gt lt td gt lt td class cab_form colspan 2 gt lt td gt lt tr gt lt table gt lt td gt lt tr gt lt c if test not empty items gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla_no_borde width 90 gt lt bean message key web ui resultado gt lt td gt lt td align right gt lt html submit styleClass button onclick this form method value editarUsuario key web ui boton editar gt lt html submit gt lt td gt lt td width 1 gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt c if test empty METODO gt lt c set var METODO value editarUsuario gt lt c if gt lt display table name items id item class esmena requestURI ACCION do method listarUsuarios style width 100 sort list pagesize 100 defaultorder asc
84. head gt lt body gt lt table width 100 border 0 cellspacing 2 cellpadding 1 style margin top 0 gt lt c if test empty ACCION gt lt c set var ACCION value security gt lt c if gt html form action ACCION onsubmit document forms 0 name usuarioForm return validateUsuarioForm this gt html hidden property method value olvidoClave gt html hidden property id_usuario value usuario id gt html hidden property isOlvido value param isOlvido gt html hidden property j_u value param j_u gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab tabla no borde width 90 gt lt bean message key web ui usuario info gt lt td gt lt td align right gt lt html submit styleClass button onclick this form method value olvidoClave key web ui boton grabar gt lt html submit gt lt td gt lt td width 1 gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla colspan 2 gt lt bean message key web ui usuario olvido gt lt td gt gt lt bean message 112 lt tr gt lt tr gt lt td class cab_form width 20 gt lt bean message key web ui usuario id gt lt td gt lt td class det_form gt u
85. http HttpServletResponse import org springframework context ApplicationContext import org springframework web context support WebApplicationContextUltils import com bvg comun security model auth Log import com bvg comun security model auth Usuario import com bvg comun security util CredencialAcceso import com bvg comun security util LoginAuthorization import com bvg comun security util UsuarioLogin import com bvg comun security util matcher URL Pattern import com bvg comun security util matcher URLPatternFactory import com bvg comun security util matcher URLPatternMatcher public class SecurityFilter implements Filter Permite obtener acceso al LoginAuthorization FilterConfig filterConfig Validacion de Opciones a trav s de patrones de RegEx URLPatternFactory urlPatternFactory Nombre del Bean que tiene el acceso a datos String loginAuthorizationParam Nombre del Usuario Invitado String loginGuestUser final private static String SESSION LOGGED W L1 SESSION LOGGED private final static String SESSION LAST URI W L1 SESSION LAST URI Parametro de Inicializacion public final static String LOGIN AUTHORIZATION PARAM loginAuthorization public final static String LOGIN USUARIO INVITADO PARAM guestUser Login del Usuario public final static String SESSION USERLOGIN SESSION USERLOGIN Mensaje de Error al Logonearse y no autenticarse public final static String SECURITY MSGLOGIN SECURITY MSGL
86. ion jawa displaytag properties ehcache xml E sa 3 log4j dtd sa E log4j xml messages properties 26 a Web Content CO META INF H E webicss H E webtimg H E web img footer E 423 webijsi calendar E 0 web jstmenu 0 webtisptierror Es 404 jsp ss 500 jsp CO web jsplinclude i i blanco jsp i botones jsp 3 s include jsp mensajes jsp DB webljspisecurity i Be cambio clave jsp 53 editar menu jsp editar_rol jsp zg editar usuario jsp Be listar menus jsp listar roles jsp s listar usuarios jsp i olvido_clave jsp WEB INF i ka action servlet xml i ce applicationContext xml BA struts config xml sa validation xml lt e validator rules xml 8 web xml D WEB INFiclasses 73 WEB INFiclasses__ com 73 WEB INFidtds 7 WEB INF lib 3i 7 WEB INFitld index jsp E intro jsp login jsp logoff jsp side menu jsp 27 listarUsuarios webjsp securityleditar usuario jsp Aintro jsp Isecuri web jsp securityleditar personajsp ediarUsuarb listarRoles webjsp securitylistar_roles jsp iwebjspisecurityicambio clave jsp Iwebjsp securitylistar menus jsp editarPersona listarPersonas lwebjjsp securitylistar personas jsp buscarMenu editarMenu buscarRol 2 webjsp security editar_menujsp buscarEmpleado listar
87. isplay column title Estado style text align center white space nowrap gt lt c if test item estado A gt lt bean message key web ui eliminable estado activo gt lt c if gt cif test item estado I gt lt bean message key web ui eliminable estado inactivo gt lt c if gt lt display column gt lt display table gt lt td gt lt tr gt lt html form gt lt c if gt lt table gt lt body gt lt html gt Validacion html javascript formName menuForm gt lt Mensajes gt lt include file web jsp include mensajes jsp gt editar_rol jsp lt include file web jsp include taglibs jsp gt lt html gt lt head gt lt include file web jsp include include jsp gt lt head gt 96 lt body gt lt table width 100 border 0 cellspacing 2 cellpadding 1 style margin top 0 gt lt c if test empty ACCION gt lt c set var ACCION value security gt lt c if gt html form action ACCION onsubmit document forms 0 name rolForm return validateRolForm this gt html hidden property method value guardarRol 5 html hidden property ejecutar_metodo value METODO gt lt html hidden property id_rol value rol id gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla_no_borde width 90 gt lt bean message key web ui rol info gt lt td gt lt
88. ity d Mantenimiento d Isecurity do method listarRoles Mantenimiento d security do method listarMenus Un registro encontrado P g anrne DarwinMenu actin Nombre Fig 2 24 2 Creacion de submenu Se debe colocar el url de acci n o permiso como en el ejemplo web jsp alumno Ingreso de alumno donde web jsp es la ruta de la carpeta donde se guardaran los jsp alumno es el padre del submenu Ingreso de Alumno es el submen a crear del menu principal Luego de Ilenar todos los parametros requeridos presionamos grabar y desde luego mostrara mensaje de transacci n exitosa Usuario ADMIN _ Sali ACADEMICO Informaci n del Men Administrar Seguridad Datos de acceso y control Mantenimiento de Usuarios Mantenimiento de Roles Mantenimiento de Menus Nombre del Menu Ingreso de Alumnos Fig 2 24 3 Creacion de Submenu 25 Visualizaci n Creaci n de un Menu y sus respectivos Submenus Usuario ADMIN Sali ACADEMICO Informaci n del Men Administrar Seguridad Mantenimiento de Usuarios Mantenimiento de Roles Nombre del Menu Opciones del Alumno Mantenimiento de Menus Datos de acceso y control Menu Padre Url de Acci n o Permiso web jsp alumno Orden o Mostrable SI v Estado Acro v Sub menus asignados Agregar Quitar Encontrados 2 registros mostrando todos los registros Pag 1 Escoger Codigo Nombre Url Estado O 10909 Ingreso d
89. lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest msg errors required gt lt validator name validwhen msg errors required classname org apache struts validator validwhen ValidWhen method validateValidWhen methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest validator name minlength classname org apache struts validator FieldChecks 119 method validateMinLength methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends msg errors minlength jsFunction org apache commons validator javascript validateMinLength 5 lt validator name maxlength classname org apache struts validator FieldChecks method validateMaxLength methodParams java lang Object org apache commons validator ValidatorAction org apache commons validator Field org apache struts action ActionMessages org apache commons validator Validator javax servlet http HttpServletRequest depends
90. les para la asignaci n 10 Administrar Seguridad Mantenimiento de Usuanos Mantenimiento de Soles Mantenimiento de Menus Encontrados 8 registros mostrando todos los registros P g 1 Escoger C digo Nombre Descripci n 0 Administrador del Sutera Admnet acon del Setera O O a Wssaro mrtaso Jopcones Ge etas o Acmnstrac n de Seguros Martesimento Ge usuares roies y menus El uso Fig 2 8 2 Asignar un Rol a un Usuario Se debe elegir el rol que se desee haciendo click en el bot n de la columna Escoger y luego presionar el bot n Agregar Despu s le aparecer la siguiente pantalla donde se debe presionar Aceptar y luego el bot n grabar Administrar Seguridad Mantenimiento de Usuarios Mantenimiento de Roles Mantenimiento de Menus Tranzacoon Exitosa Jonathan Suarez Hereda Admnistrac n de Seguridad mami Roles asignados Agregar Quitar Un registro encontrado P g 1 Escoger Codigo Hombre Descripcion Estado Administraci n de Seguridad Mantenimiento de usuarios roles y menus ACTNO 2 Opciones de Exportaci n C SV Excel XML Fig 2 8 3 Asignar un Rol a un Usuario Donde le aparecer una nueva pantalla indicando que la transacci n se guardo correctamente 11 Luego se presiona aceptar y despu s grabar donde le mostrara la siguiente pantalla donde indica que la transacci n fue exitosa Informaci n del Usuario Grabar Datos de Autenticaci n Estado
91. lign top bgcolor 00558C gt lt table width 182 border 0 cellspacing 0 cellpadding 0 gt lt tr height 37px gt lt td width 182 gt lt div id titulo_app gt amp nbsp lt bean message key web ui titulo gt lt div gt lt td gt lt tr gt tr height 1 0px gt lt td gt lt td gt lt tr gt lt tr gt lt td gt lt img src web img menu_sup gif width 182 height 17 gt lt td gt lt tr gt lt tr gt lt td bgcolor D5E2F1 gt lt include file side_menu jsp gt lt td gt lt tr gt lt tr gt lt td gt lt img src web img menu_inf gif width 182 height 17 gt lt td gt lt tr gt lt tr gt lt td height 50px gt lt tr gt lt table gt lt td gt lt td width 24 valign top background web img index_11 gif gt lt table cellpadding 0 cellspacing 0 border 0 width 24 gt lt tr gt lt td gt lt img src web img index_10 gif width 24 height 18 gt lt td gt lt tr gt lt tr gt lt td gt lt img src web img index_3 gif width 24 height 8 gt lt td gt lt tr gt lt tr gt lt td gt lt img src web img index_7 gif width 24 height 23 gt lt td gt lt tr gt lt table gt lt td gt lt td valign top gt lt table cellpadding 0 cellspacing 0 border 0 width 100 gt lt tr gt lt td width 23 bgcolor 00558C valign top gt lt img src web img index_9 gif width 23 height 18 gt lt td gt lt td bgcolor 00558C valign middle align
92. lir ACADEMICO Consulta de Menus Consultar Agregar Administrar Seguridad Criterios de B squeda Mantenimiento de Usuarios securi Mantenimiento de Roles O Todos Oun security _ j Mantenimiento de Menus Estado Todos v Mostrable S v Mostrar Menus Agrupados AGRUPADOS Resultado Un registro encontrado P g 1 Escoger C digo Nombre Estado Menus Nombre URL T Administrar Sequridad activo Mantenimiento d security do method listarUsuarios url security d Mantenimiento d Isecurity do method listarRoles Mantenimiento d Jsecurity do method listarMenus Fig 2 19 Listar ments por url requerido 2 1 3 4 Listar por menus mostrables o no En esta opcion si elegimos Mostrable SI nos enlistara los menus que est n asignados a un rol y que se muestran para los usuarios Mostrable NO nos enlistara los menus que se estan asignados a un rol y que no se muestran para los usuarios 20 Usuario ADMIN Salir ACADEMICO Consulta de Menus Administrar Seguridad Criterios de B squeda Mantenimiento de Usuarios Mantenimiento de Roles O Todos Mantenimiento de Menus Estado ACTVO Mostrar Menus Agrupados AGRUPADOS z xj Resultado Encontrados 3 registros mostrando todos los registros P g 1 Escoger C digo Nombre Estado Nombre 7 Administrar Seguridad ACTIVO Mantenimiento d security do method listarUsuarios url security d Mantenimiento d security do method listarRoles Mantenimiento
93. login return mapping findForward index public ActionForward bienvenida ActionMapping mapping ActionForm form HttpServletRequest request HtipServletResponse response throws Exceptionf String isCambio String request getSession getAttribute Usuario CLAVE_CAMBIADA if isCambio null amp amp isCambio compareTo Usuario INICIAL 0 UsuarioLogin usuarioLogin UsuarioLogin request getSession getAttribute SecurityFilter SESSION USERLOGIN if usuarioLogin null request getRequestDispatcher security do method cambioClave forward request response return mapping findForward paginaEnBlanco P gina Vac a public ActionForward paginaVacia ActionMapping mapping X ActionForm form HttpServletRequest request HttpServletResponse response throws Exception return mapping findForward paginaMensajes Acci n no especificada public ActionForward 7unspecified ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response throws Exception 65 return index mapping form request response public void setModelManager ModelManager mgr this manager mgr M todos Utiles public boolean isMetodoCorrecto String metodo Method metodos this getClass getMethods if metodos null amp amp metodos length gt 0 Method method null for int i 0 i lt metodos length i method metodos i if method
94. lt html option value NOMBRE DE MI PAPA gt NOMBRE DE MI PAPA lt html option gt lt html option value FECHA DE NACIMIENTO DE MI PAPA gt FECHA DE NACIMIENTO DE MI PAPA lt html option gt html option value FECHA DE NACIMIENTO DE MI MAMA gt FECHA DE NACIMIENTO DE MI MAMA lt html option gt lt html select gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui usuario respuesta gt lt td gt lt td class det_form gt lt html password property usuario respuesta size 20 maxlength 250 gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui eliminable estado gt lt td gt lt td class det_form gt lt html select property usuario estado gt html option value A gt lt bean message key web ui eliminable estado activo gt lt html option gt cif test SESSION_USERLOGIN loginName usuario id gt html option value I gt lt bean message key web ui eliminable estado inactivo gt lt html option gt lt c if gt lt html select gt lt td gt lt tr gt lt table gt lt td gt lt tr gt lt html form gt cif test usuario new gt lt html form action ACCION gt html hidden property method value quitarRol gt lt html hidden property id usuario value usuario id gt 101 lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla
95. ml option gt html option value N gt lt bean message key web ui mostrable no gt lt html option gt lt html select gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui eliminable estado gt lt td gt lt td class det_form gt lt html select property menu estado gt lt html option value A gt lt bean message key web ui eliminable estado activo gt lt html option gt html option value I gt lt bean message key web ui eliminable estado inactivo gt lt html option gt lt html select gt lt td gt lt tr gt lt table gt lt td gt lt tr gt lt html form gt cif test menu new gt cif test empty ACCION gt lt c set var ACCION value security gt lt c if gt lt html form action ACCION onsubmit document forms 0 name menuForm return validateMenuForm this gt lt html hidden property method value guardarUsuario gt lt html hidden property ejecutar metodo value METODO gt lt html hidden property id_menu_padre value menu id gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab_tabla_no_borde width 90 gt lt bean message key web ui menu sub_menus gt lt td gt lt td align right gt html button styleClass button onclick var popup window open contextPath security do method listarMenus amp id_menu_padre menu id popup height 400
96. mn gt html hidden property desc value 5 param desc gt lt c if gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab tabla no borde width 90 gt lt bean message key web ui menu consultar gt lt td gt lt td align right gt lt html submit styleClass button onclick this form method value listarMenus gt lt bean message key web ui boton consultar gt lt html submit gt lt td gt lt td width 1 gt lt c if test param id_rol null 8 8 param column null amp amp param id menu padre null gt lt td align right gt html button styleClass button onclick location href contextPath security do method editarMenu property gt lt bean message key web ui boton crear gt lt html button gt lt td gt lt td width 1 gt lt c if gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt 103 lt td class cab_tabla gt table width 10096 border 0 gt lt tr gt lt td class cab_tabla colspan 7 width 100 gt lt bean message key web ui criterios gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt html radio property cmbTextToFind value TODOS gt lt bean message key web ui todos gt lt html radio gt lt td gt lt td class cab_form gt lt html radio property cmbTextToFind value NOMBRE gt lt bean message key web ui n
97. mport com bvg comun web ui Mensajes public class SecurityAction extends GlobalAction URL de la acci n de struts public static final String SECURITY ACCION security public ActionForward listarUsuarios ActionMapping mapping ActionForm form HttpServletRequest request HtipServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION DynaActionForm dynaForm DynaActionForm form String textToFind String dynaForm get textToFind String cmbTextToFind String dynaForm get cmbTextToFind String cmbEstado String dynaForm get cmbEstado List usuarios null HashMap filtros new HashMap List result new ArrayList if cmbTextToFind 2 null amp amp cmbTextToFind length gt 0 if cmb TextToFind compareTo NOMBRE 0 amp amp textToFind null amp amp textToFind length gt 0 filtros put url like textToFind toUpperCase trim filtros put nombre like textToFind toUpperCase trim if cmbTextToFind compareTo USUARIO 0 48 textToFind null amp amp textToFind length gt 0 filtros put id like textToFind if cmbEstado null amp amp cmbEstado length 50 88 cmbEstado compareTo TODOS 0 filtros put estado cmbEstado usuarios manager getUsuarios filtros for Itera
98. n auto l gt lt set gt lt property name nombre type java lang String update true insert true column nombre not null true l gt lt property name descripcion type java lang String update true insert true column descripcion l gt lt property name estado type java lang String update true insert true column estado not null true l gt lt class gt lt hibernate mapping gt Rol java package com bvg comun security model auth import java util HashSet import java util Iterator import java util Set import com bvg comun persistencia EntidadEliminable public class Rol extends EntidadEliminable private String nombre private String descripcion private Set menus new HashSet public Rol super public Long getld return id public Set getMenus return menus public void setMenus Set menus this menus menus public void addMenu Menu o for Iterator iter menus iterator iter hasNext Menu op Menu iter next if op getld compareTo o getld 0 return menus add o 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 43 Usuario hbm xml Mapeo de la tabla USUARIOS
99. n del Usuario Administrar Seguridad Datos de Autenticaci n Mantenimiento de Usuarios Mantenimiento de Roles Usuario KESPINOZA Mantenimiento de Menus f Microsoft Internet Explorer x A Transacci n Exitosa Karina Espinoza Nombre de Usuario Karina Espinoza Pregunta de Recuperaci n NOMBRE DE MI PERRO Respuesta Secreta ees Estado ACTIVO v Roles asignados No existen registros para mostrar Fig 2 7 Creaci n de un Usuario Una vez que llenamos la informaci n damos clic en el boton Grabar y nos muestra un mensaje que nos indica que la Transacci n fue exitosa 2 1 1 6 Asignar un Rol a un Usuario Para poder realizar esta asignaci n primeramente debe estar creado el rol y asignado a este su respectivo menu y submenu si lo tuviere Se debe ir a la opci n Mantenimiento de Usuario elegir el usuario al cual se le va a asignar el rol le aparecer los datos del usuario Usuario ADMIN X Sali Informaci n del Usuario Grabar Administrar Seguridad Datos de Autenticaci n Mantenimiento de Usuarios Mantenimiento de Roles Mantenimiento de Menus c Usuario SUAREZ Nombre de Usuario Jonathan Suarez He Pregunta de Recuperaci n NOMBRE DE MI PERRO v Estado ACTVO vj Roles asignados No existen registros para mostrar Fig 2 8 1 Asignar un Rol a un Usuario Para asignarle un Rol en esta misma pantalla hay un bot n Agregar al presionarlo le enlistara todos los roles posib
100. n el Sistema Usuario Clave Ingresar Olvido su clave Fig 1 4 Mensaje de usuario no registrado 1 5 Clave de usuario errada En caso de que la clave no sea valida y el usuario no la recuerde tiene la opci n de poder cambiarla presionando el link Olvido su clave en la cual mostrara la siguiente pantalla Autentificaci n de Ingreso Tu login no fue exitoso Intenta de nuevo Raz n Clave no v lida Usuario Clave aga Fig 1 5 Clave de usuario errada En esta pantalla se pedira al usuario que recuerde la respuesta de la pregunta secreta que ingreso inicialmente y debe presionar el boton grabar como se muestra en la figura 1 6 Informacion del Usuario Olvido Clave Usuario DBRIONES Nombre de Usuario Darwin Briones Pregunta de Recuperacion NOMBRE DE MI MAMA Respuesta Secreta luzmila Fig 1 6 Olvido de clave En ese momento le aparece una nueva pantalla donde debe ingresar la nueva clave y la confirmaci n de la misma luego debe grabar el cambio de clave Informaci n del Usuario Cambio de clave Usuario DBRIONES Confirmaci n de la Clave ececce Nombre de Usuario Darwin Briones Fig 1 7 Cambio de clave Despues de grabar la clave el usuario debe autenticarse de nuevo en la pantalla principal del portal para acceder a sus respectivos menus y submenus de acuerdo a sus roles asignados CAPITULO 2 2 OPCIONES DEL MENU PRINCIPAL DEL ADMINISTRADOR DE SISTEMA 2 1
101. n metodo gt boton titulo lt html submit gt lt c forEach items boton parametrosOcultos var parametro gt lt html hidden property parametro nombre value parametro valor gt lt c forEach gt lt html form gt lt c when gt lt c otherwise gt lt html submit styleClass button onclick this form method value boton metodo gt boton titulo lt html submit gt lt c forEach items boton parametrosOcultos var parametro gt lt html hidden property parametro nombre value parametro valor gt lt c forEach gt lt c otherwise gt lt c choose gt lt td gt lt c forEach gt lt tr gt lt table gt lt c if gt include jsp lt request setAttribute contextPath request getContextPath request setAttribute datePattern dd MM yyyy 960 title Sistema de Administraci amp oacute n Acad amp eacute mica lt title gt meta http equiv pragma content no cache gt meta http equiv cache control content no cache gt lt meta http equiv expires content 0 gt lt response setHeader Cache Control no cache HTTP 1 1 response setHeader Pragma no cache HTTP 1 0 response setDateHeader Expires 0 prevents caching at the proxy server A gt lt link type text css rel stylesheet href contextPath web css estilo css gt lt link gt lt link type text css rel stylesheet href contextPath web css screen css media screen print
102. nstance compareTo calendar gt 0 request getSession setAttribute Usuario CLAVE CAMBIADA Usuario INICIAL else if usuario getEstadoCambio compareTo Usuario INICIAL 0 request getSession setAttribute Usuario CLAVE CAMBIADA Usuario INICIAL request getSession removeAttribute SESSION LAST URI response sendRedirect response encodeRedirectURL last uri jelse request setAttribute SECURITY MSGLOGIN WIDTHOUT PERMISSIONS request getRequestDispatcher LOG IN URL forward request response return jelse 60 if IrequestRequiresLoggedSession uri userLogin getLoginName Si este URL pertenece a usuario GUEST no problem Verificar cambio de clave Usuario usuario Usuario userLogin Date fecha usuario getFechaCambioClave if fecha null fecha usuario getFechaSolicitud Calendar calendar Calendar getInstance calendar setTime fecha calendar set Calendar MONTH calendar get Calendar MONTH 3 if Calendar getInstance compareTo calendar gt 0 f request getSession setAttribute Usuario CLAVE CAMBIADA Usuario INICIAL else if usuario getEstadoCambio compareTo Usuario INICIAL 0 request getSession setAttribute Usuario CLAVE CAMBIADA Usuario INICIAL chain doFilter request response else request setAttribute SECURITY MSGLOGIN WIDTHOUT_PERMISSIONS request getRequestDispatcher LOG IN URL forward request response catch Thr
103. ntextPath ACCION do method METODO amp id_rol item id gt item nombre lt a gt lt c if gt lt c if test param id usuario null gt item nombre lt c if gt lt display column gt lt display column property descripcion title Descripci amp oacute n style text align left white space nowrap maxLength 40 gt lt display column title Estado style text align center white space nowrap gt lt c if test item estado A gt bean message key web ui eliminable estado activo gt lt c if gt lt c if test item estado l gt lt bean message key web ui eliminable estado inactivo gt lt c if gt lt display column gt lt display table gt lt td gt lt tr gt lt c if gt lt html form gt lt table gt lt body gt lt html gt Mensajes lt include file web jsp include mensajes jsp gt 109 listar usuarios jsp lt include file web jsp include taglibs jsp gt lt html gt lt head gt lt include file web jsp include include jsp 96 lt head gt lt body gt lt table width 100 border 0 cellspacing 2 cellpadding 1 style margin top 0 gt lt c if test empty ACCION gt lt c set var ACCION value security gt lt c if gt lt html form action ACCION gt html hidden property method value listarUsuarios gt lt html hidden property ejecutar_metodo value METODO gt lt tr gt lt td class cab_tabla gt lt table wi
104. ntidad new Menu DynaActionForm dynaForm DynaActionForm form dynaForm set menu entidad request setAttribute menu entidad return mapping findForward editarMenu public ActionForward agregarSubMenu ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION String id menu padre request getParameter id menu padre ActionMessages msg new ActionErrors if id menu padre null amp amp id menu padre length gt 0 String id menu request getParameter id menu if id menu null amp amp id menu length gt 0 Menu menuPadre manager findMenuByld id menu padre if menuPadre null amp amp menuPadre getld compareTo Long valueOf id menu 0 81 Menu menu null for Iterator iter manager getMenus null iterator iter hasNext Menu menu2 Menu iter next if menu2 getld compareTo Long valueOf id menu 0 menu menu2 break for Iterator iter menuPadre getMenus iterator iter hasNext Menu menu2 Menu iter next if menu2 getld compareTo Long valueOf id menu 0 menu null break if menu null if menu getMenus null amp amp menu getMenus size gt 0 msg add ActionMessag
105. o le aparecera la siguiente pantalla donde se debe presionar Aceptar y luego el boton grabar Administrar Seguridad Mantenimiento de Ususrios Nombre del Rol SUPER Al UMNO Mantenimiento de Menus Descripci n del Rol ELER l UMNO Estado ACTVO Menus asignados Un registro encontrado P g 1 Microsoft Internet Explorer K Escoger C digo Nombre Menus Trarmacci n Extosa SUPER ALUMNO Opciones del Alumno URL D 10908 Opciones del Alumno InebispiOpcones del Akamnaingeso de JwetvpoiOpcienes del Almas Medifieacie Opciones de Exportaci n CSV Excel Fig 2 15 2 Asignaci n de un men a un Rol Donde le aparecer una nueva pantalla indicando que la transacci n se guardo correctamente Administrar Seguridad Mantenimiento de Usuarios Mantenimiento de Roles Ooo O OM Manteruruento de Menus Descripci n del Rol SUPER ALUWNO Estado Active Menus asignados Un registro encontrado P g 1 Microsoft Internet Explorer Ix Escoger C digo Nombre Menus Transacc n Exttoca SUPER ALUMNO Nombre WAL 4 Nai fwet ac Opciones del Aumnoingresa ce cacion de wediseOpceees del Aume oaifcace Opciones de Exportaci n CSV Lxcel XML Fig 2 15 3 Asignacion de un ment a un Rol En caso que se requiera que dicho Rol posea solo una de las dos opciones que se posee el menu se debe hacer un clic en el cuadrito de Quitar sobre la opci n que no se requiera en ese momento le aparecera la siguiente pantalla In
106. oll cont transparent this item_font_family cont Verdana this item_font_weight cont bold this item_font_style cont normal this item_font_size cont 11px this item_padding cont 3 5 3 3 cont List submenus new ArrayList for Iterator iter2 rol getMenus iterator iter2 nasNext Menu subMenu Menu iter2 next if subMenu getldPadre null amp amp subMenu getldPadre compareTo menu getld 0 submenus add subMenu Collections sort submenus for Iterator iter2 submenus iterator iter2 hasNext Menu subMenu Menu iter2 next if subMenu isMenuMostrable menuWeb append this item cont subMenu getNombre if subMenu getUrl null amp amp subMenu getUrl length gt 0 amp amp subMenu getEstado compareTo Eliminable ESTADO ACTIVO 0 64 menuWeb append this url cont subMenu getUrl this url_target cont iFrameAdmin cont Divisor de Grupos menuWeb append this item cont amp nbsp menuWeb append Linea divisora this item_font_family cont Arial this item_font_weight cont normal this item_font_style cont normal this item_font_size cont Opx this item_border_width cont 0 cont request setAttribute menu menuWeb else return mapping findForward
107. olor EFICCE this menu items text decoration none this menu items font family Verdana this menu items font size 11px this menu items font style normal this menu items font weight normal this menu items text align left this menu items padding 2 5 2 7 this menu items border style solid this menu items border color 6F9CCE this menu items border width 0 129 this menu items width 90 this menu items text color roll 000000 this menu items border color roll 9b9999 RRERERE KHHKK KHKKEKKKER KH IO KEKKEK HHE KKK KKKH KKKH K IS AK IGEIOEROGERORCEN RO OR ER NOn opimo einer Main Menu Settings AA II II AAA AIAS IAA AA EI OE ARIA IAA OH ROO H GO HH AI IIA this menu_background_color_main D5E2F1 this menu_items_background_color_roll_main F5F5F5 D5E2F1 fondo sombreado del item seleccionado this menu_items_text_color_main 333333 this menu items text color roll main 525252 this menu items font size roll 10px this menu items font weight roll bold this menu items border color roll main 999999 borde externo degradado this menu padding main 2 2 2 2 this menu width main 182 E8F1F7 this menu is horizontal main false this divider height main 0 this divider background color main 999999 menu WM END Menu Data ITAL lt script gt lt START NAVSTUDIO MENU TAGS 647682 gt lt div id vqp_about
108. ombre gt lt html radio gt lt td gt lt td class cab_form gt lt html radio property cmbTextToFind value URL gt lt bean message key web ui url gt lt html radio gt lt td gt lt td class det_form width 20 gt lt html text property textToFind size 30 maxlength 30 gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui eliminable estado gt lt td gt lt td class det_form gt lt html select property cmbEstado gt lt html option value TODOS gt lt bean message key web ui todos gt lt html option gt lt html option value A gt lt bean message key web ui eliminable estado activo gt lt html option gt html option value l gt lt bean message key web ui eliminable estado inactivo gt lt html option gt lt html select gt lt td gt lt td class cab_form gt lt bean message key web ui mostrable gt lt td gt lt td class det_form gt lt html select property cmbMostrable gt lt html option value S gt lt bean message key web ui mostrable si gt lt html option gt lt html option value N gt lt bean message key web ui mostrable no gt lt html option gt lt html select gt lt td gt lt tr gt lt tr gt lt td class cab form gt lt bean message key web ui agrupados gt lt td gt lt td class det_form gt lt html select property cmbAgrupados gt lt html option value AGRUPADOS gt lt bean message key
109. ombre sortable true style text align left white space nowrap maxLength 40 gt lt display column property descripcion title Descripci amp oacute n 102 style text align left white space nowrap maxLength 40 gt lt display column title Estado style text align center white space nowrap gt lt c if test item estado A gt lt bean messagekey web ui eliminable estado activo gt lt c if gt lt c if test item estado l gt lt bean message key web ui eliminable estado inactivo gt lt c if gt lt display column gt lt display table gt lt td gt lt tr gt lt html form gt lt c if gt lt table gt lt body gt lt html gt Validacion html javascript formName usuarioForm gt Mensajes lt include file web jsp include mensajes jsp gt listar_menus jsp lt include file web jsp include taglibs jsp gt lt html gt lt head gt lt include file web jsp include include jsp gt lt head gt lt body gt lt table width 100 border 0 cellspacing 2 cellpadding 1 style margin top 0 gt lt c if test empty ACCION gt lt c set var ACCION value security gt lt c if gt html form action AC CION gt html hidden property method value listarMenus gt html hidden property ejecutar metodo value METODO gt lt c if test param column null gt html hidden property column value param colu
110. on grabar Grabar web ui boton aceptar Aceptar web ui boton cancelar Cancelar web ui boton eliminar Eliminar web ui boton buscar Buscar web ui boton busqueda_avanzada Busqueda Avanzada web ui boton calcular Calcular web ui boton supervisar Supervisar Mensajes Generales app mensaje guardado El registro de 0 ha sido guardado app mensaje borrado El registro ha sido borrado 0 app mensaje no existe El registro no existe 0 app mensaje nombres no coinciden Nombres no coinciden Nuevo Nombre 0 Confirmaci n 1 app mensaje transaccion exitosa Transacci n Exitosa 0 app mensaje no userlogin No se ha autenticado por favor ingresu su usuario y clave 0 app mensaje cambio nombre no autorizado Cambio de nombre no autorizado 0 app mensaje cambio nombre no nombre anterior No se puede autorizar cambio a el mismo nombre de la nave 0 Mensajes de Error app mensaje error La aplicaci n no puede procesar su requerimiento 0 app mensaje error excepcion La excepci n encontrada es 0 86 Validacion de errors errors required 0 es requerido errors minlength 0 no puede ser menor que 1 caracteres errors maxlength 0 no puede ser mayor que 1 caracteres errors invalid 0 es inv lido errors byte 0 debe ser de tipo num rico errors short 0 debe ser de tipo num rico errors integer 0 debe ser un entero errors long 0 debe ser un entero largo errors float 0 debe ser de tipo real errors double 0
111. onMessage Mensajes APP MENSAJE ERROR No se debe asignar el mismo menu como padre entidad getldPadre else manager guardarObjeto entidad msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE TRANSACCION _EXITOSA entidad getNombre saveMessages request msg request setAttribute menu entidad return mapping findForward editarMenu Log4j xml lt xml version 1 0 encoding UTF 8 gt 84 lt DOCTYPE log4j configuration SYSTEM log4j dtd gt lt log4j configuration xmIns log4j http jakarta apache org log4j gt appender name CONSOLE class org apache log4j ConsoleAppender gt lt layout class org apache log4j PatternLayout gt lt param name ConversionPattern value p C 1 M L em9en lt layout gt lt appender gt lt logger name net sf hibernate gt level value ERROR gt lt logger gt lt logger name org springframework gt level value ERROR gt lt logger gt lt root gt level value ERROR gt lt appender ref ref CONSOLE gt lt root gt lt log4j configuration gt messages properties Mensajes usados en las etiquetas errores y en sucesos Titulos web ui titulo ACADEMICO web ui usuario consultar Consulta de Usuarios web ui usuario info Informaci n del Usuario web ui usuario datos Datos de Autenticaci n web ui usuario roles Roles asignados web ui rol consultar Consulta de Roles web ui rol info Inf
112. ontrados 8 registros mostrando todos los registros P g 1 Nombre Usuario Fecha de Creaci n ADMIN ADMIN 13 09 2006 Christian Jimenez CJIMENEZ 24 09 2006 Carla Sofia Velasco CVELASCO 15 09 2006 Darwin Briones DBRIONES 15 09 2006 Gisella Heredia GHEREDIA 15 09 2006 INVITADO INVITADO 13 09 2006 Jonathan Suarez Heredia JSUAREZ 24 09 2006 Escoger O O O O O O O Sayne Colobon SCOLOBON 23 09 2006 Fig 2 3 Lista de Todos los Usuarios 2 1 1 2 Listar Usuarios por Estado La consulta puede ser filtrada por el estado del usuario Podemos hacer un filtro de Usuarios Activos en donde me enlista todos los usuarios que pueden tener acceso al sistema a traves de la pagina web o hacer un filtro de Usuarios Inactivos el cual filtra todos los usuarios que por alguna raz n han dejado de estudiar o han dado mal uso al sistema acad mico y por ende han sido deshabilitados Usuario ADMIN X Sali Consulta de Usuarios Administrar Seguridad Criterios de Busqueda Mantenimiento de Usuarios O O Mantenimiento de Roles Todos HAWIG rea Mantenimiento de Menus Estado Todos w Resultado Encontrados 8 registros mostrando todos los registros Pag 1 Escoger Nombre Usuario Fecha de Creaci n ADMIN 13 09 2006 Christian Jimenez CJIMENEZ 24 09 2006 Carla Sofia Velasco CVELASCO 15 09 2006 Darwin Briones DBRIONES 15 09 2006 Gisella Heredia GHEREDIA 15 09 2006 INVITADO Jonathan Suarez Heredia Fig 2 4 Listar Usuarios
113. operty gt property name proxyInterfaces gt lt value gt com bvg security service ModelManager lt value gt lt property gt property name interceptorNames gt lt list gt lt value gt hibernatelnterceptor lt value gt lt list gt lt property gt lt bean gt lt bean id modelManager class org springframework transaction interceptor TransactionProxyFactoryBean gt property name transactionManager gt lt ref local transactionManager gt lt property gt lt property name target gt lt ref local managerTarget gt lt property gt property name transactionAttributes gt lt props gt lt prop key find gt PROPAGATION_REQUIRED readOnly lt prop gt lt prop key get gt PROPAGATION_REQUIRED readOnly lt prop gt lt prop key guardar gt PROPAGATION_REQUIRED lt prop gt lt prop key procesar gt PROPAGATION_REQUIRED lt prop gt lt props gt lt property gt lt bean gt bean id securityT arget class com bvg comun security dao Securitylmpl gt property name sessionFactory ref sessionFactory gt lt bean gt bean id security class org springframework transaction interceptor TransactionProxyFactoryBean gt lt property name transactionManager ref transactionManager gt property name target ref securityT arget 5 115 lt property name transactionAttributes gt props prop key get gt PROPAGATION_REQUIRED readOnly lt prop gt prop key find gt
114. ormaci n del Rol web ui rol datos Datos del Rol web ui rol menus Menus asignados web ui menu consultar Consulta de Menus web ui menu info Informaci n del Men web ui menu datos Datos de acceso y control web ui menu sub menus Sub menus asignados web ui resultado Resultado web ui criterios Criterios de B squeda web ui usuario cambio Cambio de clave web ui usuario olvido Olvido Clave Usuario web ui usuario id2 Nombre de usuario web ui usuario clave Clave web ui usuario confirmClave2Confirmaci n de la clave web ui usuario nombre Nombre corto web ui usuario pregunta Pregunta de recuperaci n web ui usuario respuesta Respuesta Secreta Rol web ui rol nombre Nombre del rol web ui rol descripcion Descripci n del men 85 Menu web ui menu nombre Nombre del menu web ui menu orden Orden web ui menu url Url de acci n o permiso web ui menu id padre Menu padre Usuario Mensajes Generales web ui nombre Nombre web ui descripcion Descripci n web ui url Url web ui todos TODOS web ui usuario Usuario de Ingreso web ui mostrable Mostrable web ui mostrable si Sl web ui mostrable no NO web ui eliminable estado Estado web ui eliminable estado activo ACTIVO web ui eliminable estado inactivo INACTIVO web ui agrupados Mostrar menus agrupados web ui agrupados si AGRUPADOS web ui agrupados no NO AGRUPADOS Botones web ui boton crear Agregar web ui boton quitar Quitar web ui boton consultar Consultar web ui boton editar Editar web ui bot
115. owable e Error al traer informaci n de la BD e printStackTrace request setAttribute SECURITY_MSGLOGIN e getMessage request getRequestDispatcher LOG_IN_URL forward request response else request getSession setAttribute SESSION LAST URI request getRequestURI request getRequestDispatcher LOG IN URL forward request response private boolean matchURL String credencial String uri try URLPattern urlPattern urlPatternFactory createURLPattern credencial 0 URLPatternMatcher matcher new URLPatternMatcher return matcher match uri urlPattern catch Exception e return false Valida si el patron pertenece al usuario INVITADO private boolean requestRequiresLoggedSession String uri String usrLogin if uri compareTo ROOT URI 0 uri compareTo ACTION URI 0 return false 61 else Iterator opciones getLoginAuthorization getOpciones usrLogin iterator while opciones hasNext CredencialAcceso credencial CredencialAcceso opciones next if matchURL credencial getPattern uri return false return true public LoginAuthorization getLoginAuthorization ApplicationContext springAppContext WebApplicationContextUtils getWebApplicationContext filterConfig getServletContext return LoginAuthorization springAppContext getBean loginAuthorizationParam public void destroy this filterConfig null
116. pServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY_ACCION String id_menu_padre request getParameter id_menu_padre ActionMessages msg new ActionErrors if id menu padre null amp amp id menu padre length 5 O String id menu request getParameter id menu if id menu null amp amp id menu length gt 0 Menu menuPadre manager findMenuByld id menu padre if menuPadre null amp amp menuPadre getld compareTo Long valueOf id menu 0 Menu menu null for Iterator iter menuPadre getMenus iterator iter hasNext Menu menu2 Menu iter next System out printin menu2 getNombre if menu2 getld compareTo Long valueOf id_menu 0 menu menu2 break if menu null amp amp menuPadre getMenus contains menu menuPadre getMenus remove menu manager guardarObjeto menuPadre menu setldPadre null manager guardarObjeto menu msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE TRANSACCION EXITOSA menuPadre getNombre menu getNombre DynaActionForm dynaForm DynaActionForm form dynaForm set menu menuPadre request setAttribute menu menuPadre saveMessages request msg return mapping findForward editarMenu else msg add ActionMessages GLOBAL M
117. para agregar un menu saveMessages request msg return editarRol mapping form request response public ActionForward guardarRol ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION DynaActionForm dynaForm DynaActionForm form Rol entidad Rol dynaForm get rol ActionMessages msg new ActionErrors manager guardarObjeto entidad msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP_MENSAJE_TRANSACCION_EXITOSA entidad getNombre saveMessages request msg request setAttribute rol entidad List menus new ArrayList for Iterator iter entidad getMenus iterator iter hasNext Menu menu Menu iter next if menu getldPadre null menus add menu request setAttribute menus menus return mapping findForward editarRol public ActionForward listarMenus ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION DynaActionForm dynaForm DynaActionForm form String textToFind
118. piledPattern protected int order protected int patternT ype protected int pathLength public URLPattern String pattern int order PatternCompiler compiler throws Exception this pattern pattern this order order initPatternT ype initPathLength initConvertedPattern initCompiledPattern compiler public String getPattern return pattern public Pattern getCompiledPattern return compiledPattern public int getPatternType return patternT ype public int getPathLength return pathLength public int getOrder return order protected void initPatternT ype if equals pattern patternT ype DEFAULT TYPE else if pattern startsWith patternType EXTENSION_TYPE else if pattern startsWith amp amp pattern endsWith patternType PATH TYPE else patternType EXACT TYPE protected void initPathLength pathLength 1 int pos pattern indexOf while pos 1 pathLength pos pattern indexOf pos 1 protected void initConvertedPattern if patternType DEFAULT_TYPE convertedPattern else StringBuffer buf new StringBuffer pattern int pos pos buf toString indexOf while pos 1 buf insert pos pos buf toString indexOf pos 2 pos buf toString indexOt while pos 1 buf replace pos pos
119. query_cache gt false lt prop gt lt prop key hibernate cache provider_class gt org hibernate cache HashtableCacheProvider lt prop gt prop key hibernate query factory_class gt org hibernate hql classic ClassicQueryTranslatorFactory lt prop gt lt props gt lt property gt lt property name eventListeners gt map entry key merge gt bean classz org springframework orm hibernate3 support IdTransferringMerge 114 EventListener gt lt entry gt lt map gt lt property gt lt bean gt lt bean id transactionManager class org springframework orm hibernate3 HibernateTransactionManager gt lt property name sessionFactory gt lt ref local sessionFactory gt lt property gt lt bean gt lt bean id hibernatelnterceptor class org springframework orm hibernate3 Hibernatelnterceptor gt property name sessionFactory gt lt ref bean sessionFactory gt lt property gt lt bean gt bean id comunDAO class com bvg comun model dao ComunDAOHibernate gt lt property name sessionFactory gt lt ref local sessionFactory gt lt property gt lt bean gt bean id managerTarget class com bvg security service Manager gt lt property name comunDAO gt lt ref local comunDAO gt lt property gt lt bean gt lt bean id businessObject class org springframework aop framework ProxyFactoryBean gt lt property name target gt lt ref bean managerTarget gt lt pr
120. r un mensaje indicando que la creaci n del Rol fue un xito En este momento podemos hacer una consulta de roles y el rol creado recientemente podr ser visualizado 15 2 1 2 6 Asignar un Menu a un Rol Para poder realizar esta asignaci n primeramente debe estar creado el menu y su respectivo submen si este lo tuviere Se debe ir a la opci n Mantenimiento de Rol elegir el Rol al cual se le va a agregar el menu Informaci n del Rol Datos del Rol Nombre del Hol SUPER ALUMNO Descripci n del Rol SUPER Al UMNO Estado ACTVO v Menus asignados Ez http 127 0 0 1 8988 Sistema de Administraci n Acad mica Micrasoft internet Explorer SER KK Consulta de Menus Criterios de B squeda C todos Estado 10204 v Mostrar Menus Agrupados AGRUPADOS Resultado Encontrados 11 registros mostrando todos los registros P g 1 Escoger C digo Nombre Estado Nombre URL Orden Administrar Seguridad activo Mantenimiento d Isecurty do melhod latarUsuarics 1 uri securty d Mantenimiento d Isecurty do methodelistarRokes 2 Hantenmesto d Isecurty do methodelstaritecus 1 Manteran ento de Usuarios sis jancu ACTVO internet Fig 2 15 1 Asignaci n de un ment a un Rol En esta misma pantalla hay un bot n Agregar al presionarlo le enlistara todos los menus posibles para la asignacion Se debe elegir el que se desee haciendo click en el boton de la columna Escoger y luego presionar el boton Agregar Lueg
121. ram desc gt value lt c out value item nombre gt window close gt item id lt a gt lt c if gt cif test param column null gt item id lt c if gt lt display column gt lt display column title Nombre sortable true style text align left white space nowrap maxLength 40 gt lt c if test param id rol null amp amp param column null amp amp param id menu padre null gt lt a href contextPath ACCION do method METODO amp id_menu item id gt item nombre lt br gt url item url lt a gt lt c if gt lt c if test param id_rol null param column null param id menu padre null gt item nombre lt br gt url item url lt c if gt lt display column gt lt display column title Estado style text align center white space nowrap gt lt c if test item estado A bean message key web ui eliminable estado activo gt lt c if gt lt c if test item estado l gt lt bean message key web ui eliminable estado inactivo gt lt c if gt lt display column gt lt display column title Menus style text align left white space nowrap gt lt display table name item menus id menu class esmena style width 100 sort list pagesize 100 defaultorder ascending defaultsort 3 export false gt lt display setProperty name paging banner all_items_found value gt display setP
122. rio DynaActionForm dynaForm DynaActionForm form dynaForm set usuario usuario if usuario getRespuesta null usuario getRespuesta length lt 0 msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR El usuario no tiene una respueta asignado a la pregunta saveMessages request msg return mapping findForward logoff saveMessages request msg return mapping findForward olvidoClave msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP_MENSAJE_ERROR No esta accediendo a esta pagina de manera correcta saveMessages request msg return paginaVacia mapping form request response public ActionForward agregarRol ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION String id_usuario request getParameter id_usuario ActionMessages msg new ActionErrors if id_usuario null amp amp id_usuario length gt 0 String id rol request getParameter id rol if id rol null amp amp id rol length gt 0 f Usuario usuario manager findUsuarioByld id_usuario Rol rol null for Iterator iter manager getRoles null iterator iter hasNext Rol rol2 Rol iter next
123. rnMatcher return new URL PatternMatcher public URLPattern createURLPattern String pattern int order throws Exception return new URLPattern pattern order compiler URLPatternMatcher java URLPatternMatcher guarda el objeto que va a aser usado para la combinacion requeridad de pattern con el URLPattern objects package com bvg comun security util matcher import org apache oro text regex PatternMatcher import org apache oro text regex Perl5Matcher public class URLPatternMatcher private PatternMatcher patternMatcher public URLPatternMatcher patternMatcher new Perl5Matcher public boolean match String pattern URLPattern urlPattern throws Exception return patternMatcher matches pattern urlPattern getCompiledPattern CredencialAcceso java Devuelve el credencial de acceso a una opcion package com bvg comun security util public interface CredencialAccesof public String getPattern LoginAuthorization java Devuelve un usuario si fue encontrado package com bvg comun security util 53 import java util List import com bvg comun security model auth Log public interface LoginAuthorizationf public UsuarioLogin getUsuario String userlogin public List getOpciones String userlogin public void saveLog Log log SHA1BASE64 java Metodo que nos ayuda a encriptar las claves de cada usuario del sistema package com bvg comun security util import java io
124. rol getEstado toUpperCase trim indexOf cmbEstado toUpperCase trim 1 sw true if Isw result add rol request setAttribute items items 74 return mapping findForward listarRoles public ActionForward editarRol ActionMapping mapping ActionForm form HttpServletRequest request HtipServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION String id request getParameter id_rol Rol entidad null if id null amp amp id length gt 0 entidad manager findRolWithMenus id else entidad new Rol DynaActionForm dynaForm DynaActionForm form dynaForm set rol entidad request setAttribute rol entidad List menus new ArrayList for Iterator iter entidad getMenus iterator iter hasNext Menu menu Menu iter next if menu getldPadre null menus add menu request setAttribute menus menus return mapping findForward editarRol public ActionForward agregarMenu ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION
125. roperty name paging banner page link value gt lt display setProperty name basic msg empty_list value gt display setProperty name paging banner full value gt lt display setProperty name paging banner first value gt display setProperty name paging banner last value gt lt display setProperty name paging banner page selected value gt lt display column property nombre title Nombre style text align left white space nowrap maxLength 15 gt 106 display column propertyz url title URL style text align left white space nowrap maxLength 40 gt lt display column property orden title Orden style text align center white space nowrap gt lt display table gt lt display column gt lt display table gt lt td gt lt tr gt lt c if gt lt html form gt lt table gt lt body gt lt html gt Mensajes lt include file web jsp include mensajes jsp gt listar_roles jsp lt include file web jsp include taglibs jsp gt lt html gt lt head gt lt include file web jsp include include jsp gt lt head gt lt body gt lt table width 100 border 0 cellspacing 2 cellpadding 1 style margin top 0 lt c if test empty ACCION gt lt c set var ACCION value security gt lt c if gt lt html form action ACCION gt html hidden property method value listarUsuarios 5 lt html hidden property ejecutar_metodo
126. security web SecurityAction singleton false gt lt property name modelManager gt lt ref bean modelManager gt lt property gt lt bean gt lt beans gt aplicationContext xml lt beans gt DataSource lt bean id dataSource lt property name driverClassName gt lt value gt com microsoft jdbc sqlserver SQLServerDriver lt value gt lt property gt property name url gt lt value gt jdbc Microsoft sqlserver 127 0 0 1 1433 113 DatabaseName portalweb SelectMethod cursor lt value gt lt property gt lt property name username gt lt value gt sa lt value gt lt property gt lt property name password gt lt value gt zaqxsw80 lt value gt lt property gt lt property name initialPoolSize value 5 gt property name minPoolSize value 5 gt lt property name maxPoolSize value 15 gt lt property name maxldleTime value 30 gt lt property name idleConnectionT estPeriod value 30 gt property name driverClass value org postgresql Driver gt property name jdbcUrl value jdbc postgresq 127 0 0 1 5432 academico gt property name driverClass value com microsoft jdbc sqlserver SQLServerDriver gt property name jdbcUrl value jdbc Microsoft sqlserver 127 0 0 1 1433 DatabaseName academico SelectMethod cursor gt lt property name user value sa gt lt property name password value tequila gt property name driverClass value com microsof
127. st gt lt welcome file gt index jsp lt welcome file gt lt welcome file list gt lt error page gt lt error code gt 404 lt error code gt lt location gt web jsp error 404 jsp lt location gt lt error page gt lt error page gt lt error code gt 500 lt error code gt lt location gt web jsp error 500 jsp lt location gt lt error page gt lt web app gt index jsp lt System out print simon response sendRedirect response encodeRedirectURL request getContextPath global do System out print simon 96 intro jsp lt include file web jsp include taglibs jsp gt lt html gt lt head gt lt include file web jsp include include jsp gt lt script type text javascript gt 125 window onresize function sTitleArray Admin for var i 0 i lt sTitleArray length i siFramelD iFrame sTitleArray i var f document getElementByld siFramelD varh if f contentDocument h f contentDocument documentElement offsetHeight 20 px f setAttribute height h f parentNode setAttribute height h else if f contentWindow h f contentWindow document body scrollHeight 5 px f setAttribute height h f parentNode setAttribute height h y lt script gt lt head gt lt body bgcolor ffffff gt table border 0 cellspacing 0 cellpadding 0 width 100 gt lt tr gt lt td width 182 va
128. stancia public static final String EJECUTAR_METODO ejecutar_metodo protected ModelManager manager null P gina de Inicio public ActionForward index ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response throws Exception UsuarioLogin usuarioLogin UsuarioLogin 63 request getSession getAttribute SecurityFilter SESSION USERLOGIN if usuarioLogin null Usuario ususario manager findUsuarioByldWhithRoles usuarioLogin getLoginName request getSession setAttribute usuario ususario StringBuffer menuWeb new StringBuffer int cont 0 for Iterator iter ususario getRoles iterator iter hasNext Rol rol Rol iter next List menus new ArrayList rol getMenus Collections sort menus for Iterator iterator menus iterator iterator hasNext Menu menu Menu iterator next if menu getldPadre null amp amp menu getEstado compareTo Eliminable ESTADO ACTIVO 0 amp amp menu isMenuMostrable menuWeb append this item cont menu getNombre menuWeb append Fondo y borde grupo this item_background_color cont ffffff this item_border_color cont 9b9999 this item_border_color cont 9b9999 this item_border_color_roll cont 9b9999 this item_border_color_roll cont 9b9999 this item_border_width cont 0 Fuente grupo this item_background_color_r
129. stas opciones pueden ser 1 Listar todos los menus 2 Listar los men s por Nombre 3 Listar los men s por el Url correspondiente 4 Listar men s Mostrables o no mostrables 5 Listar men s por estado 6 Listar los men s por su agrupamiento 7 Creaci n de un Men 8 Creaci n de Submen ACADEMICO Administrar Seguridad Mantenimiento de Usuarios Mantenimiento de Roles Mantenimiento de Menus 18 Usuario ADMIN X Sali Consulta de Menus Agregar Criterios de Busqueda Foe Estado Todos Mostrar Menus Agrupados AGRUPADOS __ v Fig 2 16 Mantenimiento de Men s Esta consulta puede ser masiva sin filtros listando todos los men s que se encuentran almacenados en el sistema ACADEMICO Administrar Seguridad Mantenimiento de Usuarios Mantenimiento de Roles Mantenimiento de Menus E Consulta de Menus Criterios de B squeda Todos Estado Todos Mostrar Menus Agrupados AGRUPADOS v Resultado Encontrados 3 registros mostrando todos los registros P g 1 Escoger C digo Nombre Estado Menus Nombre URL Mantenimiento d security do method listarUsuarios Mantenimiento d security do method listarRoles Mantenimiento d security do method iistarMenus Un registro encontrado Pag Nombre URL SubMenuDeDarwin IsubllenuDeDarwin Administrar Seguridad o y url security d ACTIVO DarwinMenu o ES url urlMenu Nombre URL Ingreso de Nota d Modificacion de
130. suario id lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui usuario nombre gt lt td gt lt td class det_form gt usuario nombre lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui usuario pregunta gt lt td gt lt td class det_form gt usuario pregunta lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui usuario respuesta gt lt td gt lt td class det_form gt lt input type text name usuario respuesta size 20 maxlength 250 gt lt td gt lt tr gt html hidden property usuario nombre value usuario nombre gt html hidden property usuario clave value usuario clave gt html hidden property usuario confirmClave value usuario confirmClave gt html hidden property usuario respuesta value usuario respuesta gt html hidden property usuario estado value usuario estado gt lt table gt lt td gt lt tr gt lt html form gt lt table gt lt body gt lt html gt Validacion html javascript formName usuarioForm gt Mensajes lt include file web jsp include mensajes jsp gt action servlet xml beans bean name global class com bvg comun web GlobalAction singleton false gt lt property name modelManager gt lt ref bean modelManager gt lt property gt lt bean gt lt bean name security class com bvg
131. t lt INPUT type text name nombreMenu id nombreMenu size 20 maxlength 100 readonly readonly gt html button styleClass button onclick var popup window open contextPath security do method listarMenus amp id_menu menu id amp column menu idPadre 8desc nombreMenu popup height 400 width 800 status yes resizable yes toolbar no menubar no scrollbars yes location no if popup popup focus property gt lt bean message key web ui boton buscar gt lt html button gt html button styleClass button onclick if document all menu idPadre document all menu idPadre value document all menu idPadre disabled disabled if document all nombreMenu document all nombreMenu gt lt bean message 94 value property lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui menu url gt lt td gt lt td class det_form gt lt html text property menu url size 40 maxlength 100 gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui menu orden gt lt td gt lt td class det_form gt lt html text property menu orden size 3 maxlength 3 gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui mostrable gt lt td gt lt td class det form gt lt html select property menu mostrable gt lt html option value S gt lt bean message key web ui mostrable si gt lt ht
132. t jdbc sqlserver SQLServerDriver gt lt property name jdbcUrl value jdbc Microsoft sqlserver 127 0 0 1 1433 DatabaseName academico SelectMethod cursor gt lt property name driverClassName value org postgresql Driver gt property name url value jdbc postgresal 127 0 0 1 5432 postgres gt lt property name username value postgres gt lt property name password value postgres gt lt bean gt Hibernate SessionFactory bean id sessionFactory class org springframework orm hibernate3 LocalSessionFactoryBean gt property name dataSource gt lt ref local dataSource gt lt property gt lt property name mappingResources gt lt list gt Se maneja la Seguridad lt value gt com bvg comun security model auth Log hbm xml lt value gt value com bvg comun security model auth Usuario hbm xml value value com bvg comun security model auth Rol hbm xml value lt value gt com bvg comun security model auth Menu hbm xml lt value gt lt list gt lt property gt lt property name hibernateProperties gt lt props gt prop key hibernate show_sql gt false lt prop gt lt prop key hibernate generate_statistics gt false lt prop gt lt prop key hibernate use_sql_comments gt false lt prop gt lt prop key hibernate dialect gt org hibernate dialect PostgreSQLDialect lt prop gt lt prop key hibernate statement_cache size gt 0 lt prop gt lt prop key hibernate cache use_
133. td class cab_form gt lt bean message key web ui usuario clave gt lt td gt lt td class det_form gt lt html password property usuario clave size 10 maxlength 16 gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui usuario confirmClave gt lt td gt lt td class det form 5 html password property usuario confirmClave size 10 maxlength 16 gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt bean message key web ui usuario nombre gt lt td gt lt td class det_form gt usuario nombre lt td gt lt tr gt html hidden property usuario nombre value usuario nombre gt html hidden property usuario pregunta value usuario pregunta gt html hidden property usuario respuesta value usuario respuesta gt html hidden property usuario estado value usuario estado gt lt table gt lt td gt lt tr gt lt html form gt lt table gt lt body gt lt html gt Validacion html javascript formName usuarioForm gt Mensajes lt include file web jsp include mensajes jsp gt editar_menu jsp lt include file web jsp include taglibs jsp gt lt html gt 93 lt head gt lt include file web jsp include include jsp gt lt head gt lt body gt lt table width 100 border 0 cellspacing 2 cellpadding 1 style margin top 0 gt lt c if test empty ACCION gt lt c set var
134. tidad isNew if entidad instanceof Eliminable Eliminable eliminable Eliminable entidad eliminable setEstado Eliminable ESTADO ACTIVO comunDAO guardarObjeto entidad public Usuario findUsuarioByldWhithRoles String usuarioLogin return comunDAO findUsuarioByldWhithRoles usuarioLogin public Usuario findUsuarioByld String loginName return comunDAO findUsuarioByld loginName public List getMenus HashMap filtros List list comunDAO getMenus filtros Set set new HashSet list list new ArrayList set return list public List getUsuarios HashMap filtros return comunDAO getUsuarios filtros public List getRoles HashMap filtros return comunDAO getRoles filtros public Rol findRolWithMenus String id return comunDAO findRolWithMenus Long valueOf id public Menu findMenuByld String id return comunDAO findMenuByld Long valueOf id SecurityFilter java Implementa la seguridad del sistema package com bvg comun web security import java io IOException import java util Calendar import java util Collection 56 import java util Date import java util Iterator import javax servlet Filter import javax servlet FilterChain import javax servlet FilterConfig import javax servlet ServletException import javax servlet ServletRequest import javax servlet ServletResponse import javax servlet http HttpServletRequest import javax servlet
135. tor iter usuarios iterator iter hasNext Usuario usuario Usuario iter next boolean sw false 67 if CmbTextToFind compareTo NOMBRE 0 48 textToFind null amp amp textToFind length gt 0 if usuario getNombre toUpperCase trim indexOf textT oFind toUpperCase trim 1 sw true if CmbTextToFind compareTo USUARIO 0 amp amp textToFind null amp amp textToFind length gt 0 if usuario getld toUpperCase trim indexOf textT oFind toUpperCase trim 1 sw true if cmbEstado null amp amp cmbEstado length gt O 48 cmbEstado compareTo TODOS 0 if usuario getEstado toUpperCase trim indexOf cmbEstado toUpperCase trim 1 sw true if Isw result add usuario request setAttribute items result return mapping findForward listarUsuarios public ActionForward editarUsuario ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION String id usuario request getParameter id usuario Usuario usuario null if id usuario null amp amp id usuario length gt 0 usuario manager findUsuarioByld id usuario usuario setConfirmClave us
136. true if cmbTextToFind compareTo URL 0 amp amp textToFind null amp amp textToFind length gt 0 if menu getUrl toUpperCase trim indexOf textToFind toUpperCase trim 1 sw true if cmbEstado null amp amp cmbEstado length gt O amp amp cmbEstado compareTo TODOS 0 if menu getEstado indexOf cmbEstado 1 sw true if cmbMostrable null amp amp cmbMostrable length gt 0 if menu getMostrable indexOf cmbMostrable 1 sw true else if menu getMostrable indexOf S 1 sw true 80 if CcmbAgrupados null amp amp cmbAgrupados length gt O amp amp cmbAgrupados compareTo AGRUPADOS 0 if menu null amp amp menu getldPadre null sw true if Isw result add menu Collections sort result request setAttribute items result return mapping findForward listarMenus public ActionForward editarMenu ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION String id request getParameter id menu Menu entidad null if id null amp amp id length gt 0 entidad manager findMenuByld id else e
137. true columnz estadocambio gt lt property name fechaCambioClave type java util Date update true insert true column fechacambioclave gt lt class gt lt hibernate mapping gt Usuario java package com bvg comun security model auth import java util ArrayList 45 46 import java util Collection import java util Date import java util HashSet import java util Iterator import java util List import java util Set import com bvg comun persistencia Eliminable import com bvg comun persistencia EntidadNatural import com bvg comun security util SHA1BASE64 import com bvg comun security util UsuarioLogin public class Usuario extends EntidadNatural implements UsuarioLogin Eliminablef public static final String INICIAL I public static final String CLAVE CAMBIADA C Fields private String clave private String estado private String nombre private String pregunta private String respuesta private Date fechaSolicitud private Set roles new HashSet private Persona persona private transient String confirmClave private String estadoCambio private Date fechaCambioClave Constructor por default public Usuario public Usuario String id this id id public String getld return this id public void setld String id this id id public void setClave String clave this clave clave public String getClave return clave
138. turn this getOrden compareT o anotherMenu getOrden return 0 public void setNombre String nombre this nombre nombre 40 public Long getldPadre return idPadre public void setIdPadre Long idPadre this idPadre idPadre public String getNombre return nombre public Set getMenus return menus public void setMenus Set menus this menus menus public String getMostrable return mostrable public void setMostrable String mostrable this mostrable mostrable public boolean isMenuMostrable if mostrable null if mostrable compareTo Menu MOSTRABLE 0 return true else if mostrable compareTo Menu NO MOSTRABLE 0 return false return false Rol hbm xml Mapeo de la tabla ROL lt hibernate mapping gt lt class name com bvg comun security model auth Rol table ROL gt lt id name id 41 column codigorol type java lang Long gt lt generator class hilo gt param name table gt uid lt param gt lt param name column gt codigorol lt param gt lt param name max_lo gt 100 lt param gt lt generator gt lt id gt lt set name menus table ROLMENU lazy false cascade save update sort unsorted order by codigomenu asc gt lt key column codigorol gt lt key gt lt many to many class com bvg comun security model auth Menu column codigomenu outer joi
139. tyFilter gt lt page import com bvg comun security util UsuarioLogin gt lt taglib uri WEB INF tld c tld prefix c gt lt UsuarioLogin userlogin UsuarioLogin request getAttribute SecurityFilter SESSION USERLOGIN if userlogin null request getRequestDispatcher global do forward request response 9o html lt head gt lt head gt lt body gt lt h1 gt Autentificaci n de Ingreso lt h1 gt lt font color black gt lt c if test not empty SECURITY_MSGLOGIN gt Tu login no fue exitoso Intenta de nuevo lt br gt Raz n lt font color red gt lt request getAttribute SecurityFilter SECURITY MSGLOGIN 96 lt font gt lt c if gt lt font gt lt form action lt c url valuez j security check html method POST onsubmit u document forms 0 j u p document forms 0 j p if u amp amp u value length 0 alert Ingrese Usuario u focus return false if p amp amp p value lengih 0 alert Ingrese Contrase a p focus return false return true gt lt table align center width 60 gt 127 lt tr gt lt td align right gt Usuario lt td gt lt td gt lt input maxlength 16 size 20 type text name j_u gt lt td gt lt tr gt lt tr gt lt td align right gt Contrase a lt td gt lt td gt lt input maxlength 16 size 20 type password name j_p gt lt td gt lt tr gt lt request setAttribute contextPath requ
140. u_padre null gt lt td align right gt lt html button styleClass button onclick var popup window open contextPath security do method agregarSubMenu amp id menu padre param id menu padre amp id menuz id selected id menu iFrameAdmin if popup popup focus property gt lt bean message key web ui boton crear gt lt html button gt html hidden property id_menu_padre value 5 param id menu padre gt lt td gt lt td width 1 gt lt c if gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt c if test empty METODO gt lt c set var METODO value editarMenu gt lt c if gt lt display table name items id item class esmena requestURI ACCION do method listarMenus style width 100 sort list pagesize 100 defaultorder ascending defaultsort 2 export false gt display column title Escoger style text align center gt lt input type radio name id_menu value item id 105 checked checked gt lt input gt lt display column gt lt display column title C amp oacute digo style text align left white space nowrap sortable true sortProperty id gt lt c if test param column null gt lt a href onClick javascript opener document forms 0 lt c out value param column valuez c out value item id gt opener document forms 0 lt c out value pa
141. uario null amp amp id usuario length gt 0 String id rol request getParameter id rol if id rol null amp amp id rol length gt 0 Usuario usuario manager findUsuarioByld id usuario Rol rol null for Iterator iter usuario getRoles iterator iter hasNext Rol rol2 Rol iter next 71 if rol2 getld compareTo Long valueOf id rol 0 rol rol2 break if rol null amp amp usuario getRoles contains rol usuario getRoles remove rol manager guardarObjeto usuario msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP_MENSAJE_TRANSACCION _EXITOSA usuario getNombre rol getNombre else msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP_MENSAJE_ERROR Escoja un rol para asignarlo al usuario else msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE ERROR Escoja un usuario para agregar un rol saveMessages request msg return editarUsuario mapping form request response public ActionForward guardarUsuario ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION DynaActionForm usuarioForm DynaActionForm form Usuario
142. uario getClave else usuario new Usuario request setAttribute usuario usuario DynaActionForm dynaForm DynaActionForm form dynaForm set usuario usuario return mapping findForward editarUsuario public ActionForward cambioClave ActionMapping mapping ActionForm form HttpServletRequest request HttpServletResponse response 68 throws Exception String accion String request getSession getAttribute ACCION if accion null accion length lt 0 request getSession setAttribute ACCION SECURITY ACCION UsuarioLogin usuarioLogin UsuarioLogin request getSession getAttribute SecurityFilter SESSION USERLOGIN ActionMessages msg new ActionErrors if usuarioLogin null String isCambio String request getSession getAttribute Usuario CLAVE CAMBIADA Usuario usuario manager findUsuarioByld usuarioLogin getLoginName if isCambio null request getSession setAttribute Usuario CLAVE CAMBIADA Usuario INICIAL jelse usuario setEstadoCambio Usuario INICIAL manager guardarObjeto usuario request setAttribute usuario usuario DynaActionForm dynaForm DynaActionForm form dynaForm set usuario usuario return mapping findForward cambioClave msg add ActionMessages GLOBAL_MESSAGE new ActionMessage Mensajes APP_MENSAJE_ERROR No esta accediendo a esta pagina de manera correcta saveMessages request msg return paginaVacia
143. usuario Usuario usuarioForm get usuario if usuario getFechaSolicitud null usuario setFechaSolicitud Calendar getlnstance getTime ActionMessages msg new ActionErrors if usuario getClave null amp amp usuario getConfirmClave null amp amp usuario getClave compareTo usuario getConfirmClave 0 boolean sw false String id_usuario request getParameter id_usuario if id usuario null amp amp id usuario length gt O f sw false else Usuario usurio2 manager findUsuarioByld usuario getld if usurio2 null sw true if Isw usuario setld usuario getld toUpperCase 72 if usuario getEstadoCambio null usuario setEstadoCambio Usuario INICIAL String isCambio String request getSession getAttribute Usuario CLAVE CAMBIADA String clave anterior request getParameter clave anterior if clave anterior null amp amp clave anterior compareTo usuario getClave 0 lignore else usuario setClave SHA1BASE64 encriptar usuario getClave if isCambio null amp amp isCambio compareTo Usuario INICIAL 0 usuario setEstadoCambio Usuario CLAVE CAMBIADA usuario setFechaCambioClave Calendar getlnstance getTimer manager guardarObjeto usuario request getSession setAttribute Usuario CLAVE CAMBIADA Usuario CLAVE CAMBIADA msg add ActionMessages GLOBAL MESSAGE new ActionMessage Mensajes APP MENSAJE TRANS
144. value METODO gt lt c if test param id usuario null gt lt html hidden property id_usuario value param id_usuario gt lt c if gt lt tr gt td class cab_tabla gt lt table width 100 border 0 gt lt tr gt lt td class cab tabla no borde width 90 gt lt bean message key web ui rol consultar gt lt td gt lt td align right gt lt html submit styleClass button onclick this form method value listarRoles gt lt bean message key web ui boton consultar gt lt html submit gt lt td gt lt td width 1 gt lt c if test param id usuario null gt lt td align right gt lt html button styleClass button onclick location href S contextPath security do method editarRol property gt lt bean message key web ui boton crear gt lt html button gt lt td gt lt td width 1 gt lt c if gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td class cab_tabla gt lt table width 100 border 0 gt 107 lt tr gt lt td class cab_tabla colspan 7 width 100 gt lt bean message key web ui criterios gt lt td gt lt tr gt lt tr gt lt td class cab_form gt lt html radio property cmbTextToFind value TODOS gt lt bean message key web ui todos gt lt html radio gt lt td gt lt td class cab_form gt lt html radio property cmbTextToFind value NOMBRE gt lt bean message key web ui nombre gt
145. vitado Opciones de invitado 10403 ADMINISTRADOR ROL ADMINISTRADOR ALUMNO ROL ALUMNO PROPESOR ROL PROFESOR COORDINADOR ROL COORDINADOR Fig 2 10 Listar todos los Roles 2 1 2 2 Listar de Roles por el Estado Los roles tambi n pueden ser consultados por su estado que puede ser Activo gt Un Rol activo es el que puede tener un usuario Inactivo gt Un Rol inactivo es el que se ha dejado de usar puede ser porque se elimino el cargo de la empresa pero que esta en el sistema definido en caso de ser requerido nuevamente 13 Ambos Todos Muestra todos los roles tanto los activos como los inactivos Administrar Seguridad Mantenimiento de Usuarios Mantenimiento de Roles Mantenimiento de Menus Usuario ADMIN X Sali Consulta de Roles Agregar Criterios de B squeda 9 Todos Estado Todos v Resultado ACTIVO O Descripci n Encontrados 5 registros mostrando todos los registros P g 1 Escoger C digo Nombre 1 Usuario Invitado ADMINISTRADOR ALUMNO lt Descripci n Opciones de invitado ROL ADMINISTRADOR ROL ALUMNO ROL PROFESOR ROL COORDINADOR PROPESOR COORDINADOR Fig 2 11 Listar Roles por el Estado Escogemos la opci n Nombre y ponemos el nombre del rol que deseo buscar tal como se muestra en la Fig 2 12 ACADEMICO Administrar Seguridad Mantenimiento de Usuarios Mantenimiento de Roles Mantenimiento de Menus Usuario ADMIN EST Consulta de Roles Agregar Criterios de B squed
146. web ui agrupados si gt lt html option gt lt html option value NO_AGRUPADOS gt lt bean message key web ui agrupados no gt lt html option gt lt html select gt lt td gt lt td class cab_form gt amp nbsp lt td gt lt td class det_form gt amp nbsp lt td gt lt tr gt lt table gt lt td gt lt tr gt lt c if test not empty items gt lt tr gt 104 lt td class cab_tabla gt table width 10096 border 0 gt lt tr gt lt td class cab_tabla_no_borde width 90 gt lt bean message key web ui resultado gt lt td gt lt c if test param id_rol null amp amp param column null amp amp param id_menu_padre null gt lt td align right gt lt html submit styleClass button onclick this form method value editarMenu gt lt bean message key web ui boton editar gt lt html submit gt lt td gt lt td width 1 gt lt c if gt cif test param id_rol null gt lt td align right gt html button styleClass button onclick var popup window open contextPath security do method agregarMenu amp id_rol param id_rol amp id_menu id_selected id_menu iFrameAdmin if popup popup focus property gt lt bean message key web ui boton crear gt lt html button gt lt html hidden property id rol value param id_rol gt lt td gt lt td width 1 gt lt c if gt lt c if test param id_men
147. xception StringBuffer query new StringBuffer from Rol o query append left outer join fetch o menus List result getHibernate Template find query toString if result null amp amp result size gt 0 for Iterator iter result iterator iter hasNext Rol rol Rol iter next if rol getld compareT o id 0 return rol return Rol result get 0 return null public Menu findMenuByld Long id StringBuffer query new StringBuffer from Menu o query append left outer join fetch o menus List result getHibernate Template find query toString if result null amp amp result size gt 0 for Iterator iter result iterator iter hasNext Menu menu Menu iter next if menu getld compareTo id 0 return menu return null Auditable java package com bvg comun persistencia import java util Date import com bvg comun security model auth Usuario public interface Auditablef public Date getFechalngreso public void setFechalngreso Date fecha public Date getFechaModificacion public void setFechaModificacion Date fecha public Usuario getUsuariolngreso public void setUsuariolngreso Usuario user public Usuario getUsuarioModificacion public void setUsuarioModificacion Usuario user Eliminable java package com bvg comun persistencia public interface Eliminable public static final String ESTADO_ACTI

Download Pdf Manuals

image

Related Search

Related Contents

  取扱説明書  文化活動 ビジネスユーザー向け提供サービス  Contenu    *428659* 428659    USER`S MANUAL - Smith-Root  LG WT5480CW Specification Sheet  

Copyright © All rights reserved.
Failed to retrieve file