Changeset 280
- Timestamp:
- 12/02/11 14:42:13 (13 years ago)
- Location:
- ether_megapoli/trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/common/implementation/com/ether/ParameterConstants.java
r269 r280 28 28 public static final String PARAMETER_STATE = "state"; 29 29 public static final String PARAMETER_HAS_ACCESS = "hasAccess"; 30 public static final String PARAMETER_KEEP_SAME_PASSWORD = "keepSamePassword"; 30 31 } -
ether_megapoli/trunk/common/implementation/com/medias/Context.java
r251 r280 1 1 package com.medias; 2 2 3 import com. medias.annuaire.Personne;3 import com.ether.user.User; 4 4 import net.sf.json.JSONObject; 5 5 import org.apache.struts.Globals; … … 190 190 final JSONObject jSONPeople = new JSONObject(); 191 191 192 final Personne people = (Personne) request.getSession().getAttribute( "SES_USER" );193 if( null == people)192 final User user = (User) request.getSession().getAttribute( "SES_USER" ); 193 if( null == user ) 194 194 return null; 195 195 196 jSONPeople.put( "name", people.getNom() );197 jSONPeople.put( "firstName", people.getPrenom() );198 jSONPeople.put( "role", people.getRoles() );196 jSONPeople.put( "name", user.getLastName() ); 197 jSONPeople.put( "firstName", user.getFirstName() ); 198 jSONPeople.put( "role", user.getRole().name() ); 199 199 return jSONPeople; 200 200 } -
ether_megapoli/trunk/service/implementation/com/medias/megapoli/struts/forms/DatasForm.java
r151 r280 4 4 package com.medias.megapoli.struts.forms; 5 5 6 import com.ether.user.User; 6 7 import com.medias.DateTime; 7 8 import com.medias.Nombre; 8 import com.medias.annuaire.Personne;9 9 import com.medias.database.objects.Capteur; 10 10 import com.medias.database.objects.Jeu; … … 259 259 { 260 260 ActionErrors errors = new ActionErrors(); 261 Personne pers = (Personne) arg1.getSession().getAttribute( "SES_USER" );262 if( pers== null )261 final User user = (User) arg1.getSession().getAttribute( "SES_USER" ); 262 if( user == null ) 263 263 { 264 264 errors.add( "dateFin", new ActionError( "errors.access.login" ) ); -
ether_megapoli/trunk/service/implementation/com/medias/megapoli/utils/MegapoliInitialisation.java
r170 r280 16 16 /** 17 17 * @author Caroline Combaz 18 * Created on 02 fev. 200518 * Created on 02 fev. 2005 19 19 */ 20 public class MegapoliInitialisation extends HttpServlet { 20 public class MegapoliInitialisation 21 extends HttpServlet 22 { 21 23 22 24 /** 23 * 25 * 24 26 */ 25 27 private static final long serialVersionUID = 1L; 26 28 // Le chemin vers les images des plates-formes 27 29 public static String pathImages; 28 29 /**30 * Constructeur par defaut31 */32 public MegapoliInitialisation() {33 super();34 }35 30 36 /** 37 * Destruction de la servlet 38 */ 39 public void destroy() { 40 super.destroy(); // Just puts "destroy" string in log 41 } 31 /** 32 * Constructeur par defaut 33 */ 34 public MegapoliInitialisation() 35 { 36 super(); 37 } 42 38 43 /** 44 * Initialisation de la servlet : 45 * <ul> 46 * <li>un objet representant l'arborescence de fichiers du site de depot est cree et place au niveau de l'application, 47 * <li>l'arborescence de dossiers est egalement creee, 48 * <li>la vue representant cette arborescence, et permettant a l'utilisateur de deposer de nouveaux fichiers est generee. 49 * </ul> 50 * @throws ServletException if an error occure 51 */ 52 public void init () throws ServletException { 53 System.out.println ("************** INITIALISATION MEGAPOLI **************"); 54 String root = this.getServletContext().getRealPath(""); 55 String webinf = this.getServletContext().getRealPath("WEB-INF"); 56 57 //on charge le fichier de proprietes 58 Properties prop = new Properties(); 59 try { 60 prop.load(new FileInputStream (webinf + "/megapoli.properties")); 61 } 62 catch (Exception e) { 63 e.printStackTrace(); 64 } 65 //on initialise l'objet représentant l'arborescence de fichiers du site de dépot et on le place au niveau de l'appli 66 String uploadRoot = prop.getProperty("data.upload.root"); 67 String uploadFile = prop.getProperty("data.upload.desc"); 68 String accessRoot = prop.getProperty ("data.access.root"); 69 this.getServletContext().setAttribute("DataDescPathName", uploadFile); 70 pathImages = prop.getProperty("data.img"); 71 Hashtable<String, String> uploadStylesheets = new Hashtable<String, String>(); 72 uploadStylesheets.put( Hierarchie.TREE, webinf + prop.getProperty("data.upload.tree.stylesheet")); 73 uploadStylesheets.put(Hierarchie.FILES, webinf + prop.getProperty("data.upload.files.stylesheet")); 74 Hashtable<String, String> uploadViews = new Hashtable<String, String>(); 75 uploadViews.put(Hierarchie.TREE,root + prop.getProperty("data.upload.tree.view")); 76 uploadViews.put(Hierarchie.FILES,root + prop.getProperty("data.upload.files.view")); 77 Hierarchie uploadTree = new Hierarchie(uploadFile, uploadRoot, uploadStylesheets, uploadViews); 78 uploadTree.setDataRoot2(accessRoot); 79 try { 80 uploadTree.createTree(); 81 uploadTree.createTreeView(); 82 } 83 catch (Exception e) { 84 e.printStackTrace(); 85 } 86 this.getServletContext().setAttribute("APP_UPLOADTREE", uploadTree); 87 88 //on fait de même avec l'arborescence de fichiers du site de consultation 89 this.getServletContext().setAttribute("uploadDir", uploadRoot); 90 this.getServletContext().setAttribute("accessDir", accessRoot); 39 /** 40 * Destruction de la servlet 41 */ 42 public void destroy() 43 { 44 super.destroy(); // Just puts "destroy" string in log 45 } 46 47 /** 48 * Initialisation de la servlet : 49 * <ul> 50 * <li>un objet representant l'arborescence de fichiers du site de depot est cree et place au niveau de l'application, 51 * <li>l'arborescence de dossiers est egalement creee, 52 * <li>la vue representant cette arborescence, et permettant a l'utilisateur de deposer de nouveaux fichiers est generee. 53 * </ul> 54 * 55 * @throws ServletException if an error occure 56 */ 57 public void init() 58 throws ServletException 59 { 60 System.out.println( "************** INITIALISATION MEGAPOLI **************" ); 61 String root = this.getServletContext().getRealPath( "" ); 62 String webinf = this.getServletContext().getRealPath( "WEB-INF" ); 63 64 //on charge le fichier de proprietes 65 Properties prop = new Properties(); 66 try 67 { 68 prop.load( new FileInputStream( webinf + "/megapoli.properties" ) ); 69 } 70 catch( Exception e ) 71 { 72 e.printStackTrace(); 73 } 74 //on initialise l'objet représentant l'arborescence de fichiers du site de dépot et on le place au niveau de l'appli 75 String uploadRoot = prop.getProperty( "data.upload.root" ); 76 String uploadFile = prop.getProperty( "data.upload.desc" ); 77 String accessRoot = prop.getProperty( "data.access.root" ); 78 this.getServletContext().setAttribute( "DataDescPathName", uploadFile ); 79 pathImages = prop.getProperty( "data.img" ); 80 Hashtable<String, String> uploadStylesheets = new Hashtable<String, String>(); 81 uploadStylesheets.put( Hierarchie.TREE, webinf + prop.getProperty( "data.upload.tree.stylesheet" ) ); 82 uploadStylesheets.put( Hierarchie.FILES, webinf + prop.getProperty( "data.upload.files.stylesheet" ) ); 83 Hashtable<String, String> uploadViews = new Hashtable<String, String>(); 84 uploadViews.put( Hierarchie.TREE, root + prop.getProperty( "data.upload.tree.view" ) ); 85 uploadViews.put( Hierarchie.FILES, root + prop.getProperty( "data.upload.files.view" ) ); 86 Hierarchie uploadTree = new Hierarchie( uploadFile, uploadRoot, uploadStylesheets, uploadViews ); 87 uploadTree.setDataRoot2( accessRoot ); 88 try 89 { 90 uploadTree.createTree(); 91 uploadTree.createTreeView(); 92 } 93 catch( Exception e ) 94 { 95 e.printStackTrace(); 96 } 97 this.getServletContext().setAttribute( "APP_UPLOADTREE", uploadTree ); 98 99 //on fait de même avec l'arborescence de fichiers du site de consultation 100 this.getServletContext().setAttribute( "uploadDir", uploadRoot ); 101 this.getServletContext().setAttribute( "accessDir", accessRoot ); 91 102 // String accessFile = prop.getProperty ("data.access.desc"); 92 103 // Hashtable<String, String> accessStylesheets = new Hashtable<String, String> (); … … 106 117 // this.getServletContext ().setAttribute ("APP_ACCESSTREE", accessTree); 107 118 108 //on charge l'annuaire et on le met aussi au niveau de l'appli... 109 Annuaire annu = new Annuaire(prop.getProperty("annuaire")); 110 this.getServletContext().setAttribute("APP_ANNUAIRE", annu); 111 112 //et idem pour l'utilitaire d'envoi des mails 113 MailFactory mail = new MailFactory(prop.getProperty("mail.host")); 114 this.getServletContext().setAttribute("APP_MAILFACTORY", mail); 115 String webmaster = prop.getProperty("mail.webmaster"); 116 this.getServletContext().setAttribute("APP_WEBMASTER", webmaster); 117 String urlCGI = prop.getProperty("url.extractcgi"); 118 this.getServletContext().setAttribute("APP_CGI", urlCGI); 119 //on charge l'annuaire et on le met aussi au niveau de l'appli... 120 Annuaire annu = new Annuaire( prop.getProperty( "annuaire" ) ); 121 this.getServletContext().setAttribute( "APP_ANNUAIRE", annu ); 119 122 120 // Initialisation d'Hibernate 121 try { 122 CommunicationBD.open(); 123 CommunicationBD.getList("select count(*) from Jeu"); 123 //et idem pour l'utilitaire d'envoi des mails 124 MailFactory mail = new MailFactory( prop.getProperty( "mail.host" ) ); 125 this.getServletContext().setAttribute( "APP_MAILFACTORY", mail ); 126 String webmaster = prop.getProperty( "mail.webmaster" ); 127 this.getServletContext().setAttribute( "APP_WEBMASTER", webmaster ); 128 String urlCGI = prop.getProperty( "url.extractcgi" ); 129 this.getServletContext().setAttribute( "APP_CGI", urlCGI ); 130 final String mailPI = prop.getProperty( "mail.PI" ); 131 this.getServletContext().setAttribute( "APP_PI", mailPI ); 132 133 // Initialisation d'Hibernate 134 try 135 { 136 CommunicationBD.open(); 137 CommunicationBD.getList( "select count(*) from Jeu" ); 124 138 // System.out.println("nombre de jeux insérés="+nbjeux.get(0)); 125 CommunicationBD.close(); 126 } catch (HibernateException e) { 127 e.printStackTrace(); 128 } 129 } 139 CommunicationBD.close(); 140 } 141 catch( HibernateException e ) 142 { 143 e.printStackTrace(); 144 } 145 } 130 146 } -
ether_megapoli/trunk/web/WEB-INF/megapoli_dev.properties
r278 r280 12 12 mail.host=mailhost.ipsl.jussieu.fr 13 13 mail.webmaster=megapoli-admin@ipsl.jussieu.fr 14 mail.PI=vmaigne@hotmail.com 14 15 url.upload=http://megapoli-dev.ipsl.jussieu.fr:8080/megapoli-dev/InitLogon.do 15 16 url.extractcgi=http://megapoli-dev.ipsl.jussieu.fr/cgi-bin/megapoli_extract.cgi -
ether_megapoli/trunk/web/WEB-INF/megapoli_prod.properties
r278 r280 12 12 mail.host=mailhost.ipsl.jussieu.fr 13 13 mail.webmaster=megapoli-admin@ipsl.jussieu.fr 14 mail.PI=Matthias.Beekmann@lisa.u-pec.fr 14 15 url.upload=http://chewie.private.ipsl.fr:8080/megapoli/InitLogon.do 15 16 url.extractcgi=http://chewie.private.ipsl.fr/cgi-bin/megapoli_extract.cgi -
ether_megapoli/trunk/web/backoffice/user-script.jsp
r277 r280 42 42 this.displayStates(); 43 43 this.displayRoles(); 44 45 $( "#keepSamePassword" ).attr( 'disabled', true ); 46 $( "#keepSamePassword" ).bind( 'click', this.onCheckKeepSamePassword ); 44 47 }, 45 48 … … 73 76 { 74 77 var parametersUrl = "id=" + this.user.id + "&name=" + $( "#lastName" ).val() + "&firstName=" + $( "#firstName" ).val() + "&email=" + $( "#email" ).val() + 75 "&pwd=" + $( "#password" ).val() + "&role=" + this.selectRoles.getValue() + "&state=" + this.selectStates.getValue() + "&hasAccess=" + $( "#boAccess" ).attr( 'checked' ); 78 "&pwd=" + $( "#password" ).val() + "&role=" + this.selectRoles.getValue() + "&state=" + this.selectStates.getValue() + 79 "&hasAccess=" + $( "#boAccess" ).attr( 'checked' ) + "&keepSamePassword=" + $( "#keepSamePassword" ).attr( 'checked' ); 76 80 $.ajax( { 77 81 url: "backoffice?methodName=modifyUser&" + parametersUrl, … … 263 267 $( "#firstName" ).val( user.firstName ); 264 268 $( "#email" ).val( user.email ); 265 $( "#password" ).val( user.password ); 269 $( "#password" ).attr( 'disabled', true ); 270 $( "#keepSamePassword" ).attr( 'disabled', false ); 271 $( "#keepSamePassword" ).attr( 'checked', true ); 266 272 this.selectRoles.select( user.role, false ); 267 273 this.selectStates.select( user.state, false ); … … 276 282 if( window.confirm( interfaceTexts["bo.user.remove.confirm"] + " " + user.firstName + " " + user.lastName + " ?" ) ) 277 283 jQuery.proxy( this.requestRemoveUser(), this ); 284 }, 285 286 onCheckKeepSamePassword: function() 287 { 288 var actualState = $( "#keepSamePassword" ).attr( 'checked' ); 289 $( "#password" ).attr( 'disabled', actualState ); 278 290 }, 279 291 … … 305 317 .removeAttr( 'selected' ); 306 318 319 $( "#keepSamePassword" ).attr( 'disabled', true ); 307 320 this.selectRoles.selectFirst( false ); 308 321 this.selectStates.selectFirst( false ); … … 318 331 if( '' == $( "#email" ).val() ) 319 332 errors = !errors ? interfaceTexts["bo.field.email"] : errors + "<BR/>" + interfaceTexts["bo.field.email"]; 320 if( '' == $( "#password" ).val() )333 if( '' == $( "#password" ).val() && !$( "#keepSamePassword" ).attr( 'checked' ) ) 321 334 errors = !errors ? interfaceTexts["bo.field.password"] : errors + "<BR/>" + interfaceTexts["bo.field.password"]; 322 335 -
ether_megapoli/trunk/web/backoffice/user.jsp
r278 r280 1 <%@ page import="com.ether.WebException" %> 1 2 <%@ page import="com.ether.user.UserRole" %> 2 3 <%@ page import="com.ether.user.UserState" %> 3 <%@ page import="com.ether.WebException" %>4 4 <%@ page language="java" contentType="text/html; charset=UTF-8" %> 5 5 <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> … … 108 108 <td><input id="password" size="40"></td> 109 109 110 <td></td> 111 <td></td> 112 </tr> 113 <tr> 114 <td><bean:message key="bo.user.password.same"/></td> 115 <td><input id="keepSamePassword" type="checkbox"><bean:message key="bo.user.password.same.help"/></td> 116 110 117 <td><bean:message key="bo.action"/></td> 111 118 <td> -
ether_megapoli/trunk/web/resources/templates/templateMegapoli.jsp
r278 r280 172 172 loginTexts["data.authentification.loginForget"] = '<bean:message key="data.authentification.loginForget"/>'; 173 173 loginTexts["data.authentification.inscription"] = '<bean:message key="data.authentification.inscription"/>'; 174 loginTexts["errors.logon.notFound"] = "<bean:message key='errors.logon.notFound' arg0="<%=Context.getWebmaster( request )%>"/>";174 loginTexts["errors.logon.notFound"] = "<bean:message key='errors.logon.notFound'/>"; 175 175 loginTexts["errors.logon.failed"] = "<bean:message key='errors.logon.failed' arg0="<%=Context.getWebmaster( request )%>"/>"; 176 loginTexts["errors.logon.notAccepted"] = "<bean:message key='errors.logon.notAccepted'/>"; 176 177 loginTexts["app.admin"] = '<bean:message key="app.admin"/>'; 177 178 loginTexts["data.authentification.text"] = "<bean:message key="data.authentification.text"/>"; -
ether_megapoli/trunk/web/src/ApplicationResources.properties
r279 r280 376 376 377 377 errors.logon.failed=Echec de l\'op\u00E9ration d'authentification.<br> Veuillez contacter le <a href\='mailto\:{0}?subject\=[MEGAPOLI]'>webmaster</a> pour lui signaler le probl\u00E8me.<br> 378 errors.logon.notFound=Ce login et/ou ce mot de passe sont inconnus.<br> Si vous voulez vous enregistrer pour obtenir l'acc\u00E8s aux zones prot\u00E9g\u00E9es du site, veuillez \u00E9crire un mail au <a href\='mailto\:{0}?subject\=[MEGAPOLI]'>webmaster</a>. <br>378 errors.logon.notFound=Ce login et/ou ce mot de passe sont inconnus.<br> Si vous voulez vous enregistrer pour obtenir l'acc\u00E8s aux zones prot\u00E9g\u00E9es du site, veuillez cliquez sur 'Nouvelle inscription'. <br> 379 379 errors.logon.login=Veuillez saisir votre login (normalement : votre mail).<br> 380 380 errors.logon.password=Veuillez saisir votre mot de passe.<br> 381 errors.logon.notAccepted=Vous n'\u00EAtes pas autoris\u00E9 \u00E0 acc\u00E9der aux zones prot\u00E9g\u00E9s. 381 382 382 383 errors.upload.file=Vous devez s\u00E9lectionner un fichier\!<br> -
ether_megapoli/trunk/web/src/ApplicationResources_en.properties
r279 r280 376 376 377 377 errors.logon.failed=The logon transaction failed. Please contact the <a href\='mailto\:{0}?subject\=[MEGAPOLI]'>webmaster</a> to report this problem.<br> 378 errors.logon.notFound=Unknown login and/or password.<br> To register and access the protected areas of this site, please write an email to the <a href\='mailto\:{0}?subject\=[MEGAPOLI]'>webmaster</a>.<br>378 errors.logon.notFound=Unknown login and/or password.<br> To register and access the protected areas of this site, please click on 'New inscription'.<br> 379 379 errors.logon.login=Please type your login (should be your email).<br> 380 380 errors.logon.password=Please type your password.<br> 381 errors.logon.notAccepted=You are not allowed to access to protected areas. 381 382 382 383 errors.upload.file=You must select a file!<br> -
ether_megapoli/trunk/web/src/com/ether/ControllerEponge.java
r279 r280 6 6 import com.ether.user.UserRole; 7 7 import com.ether.user.UserState; 8 import com.medias.annuaire.Annuaire;9 import com.medias.annuaire.Personne;10 8 import com.medias.mail.Mail; 11 9 import com.medias.mail.MailFactory; … … 54 52 @ControllerMethod(requestMandatory = true, jsonResult = true) 55 53 public JSONObject login( @ParamName(ParameterConstants.PARAMETER_LOGIN) final String login, 56 @ParamName(ParameterConstants.PARAMETER_PWD) final String p wd,54 @ParamName(ParameterConstants.PARAMETER_PWD) final String password, 57 55 @NotNull final HttpServletRequest request ) 58 56 throws ServiceException … … 61 59 final JSONObject result = new JSONObject(); 62 60 63 if( login != null && p wd != null )61 if( login != null && password != null ) 64 62 { 65 final Annuaire annu = (Annuaire) getServletContext().getAttribute( "APP_ANNUAIRE" );66 63 try 67 64 { 68 final Personne people = annu.getPersonne( login, pwd ); 69 if( people == null ) 65 final User user = _etherService.getUserByEmail( login ); 66 final String encryptedPassword = EtherHelper.encryptPassword( password ); 67 if( user == null || ( null != user && !encryptedPassword.equals( user.getPassword() ) ) ) 70 68 result.put( "errors", "errors.logon.notFound" ); 69 else if( !UserState.ACCEPTED.equals( user.getState() ) ) 70 result.put( "errors", "errors.logon.notAccepted" ); 71 71 else 72 72 { 73 request.getSession().setAttribute( "SES_USER", people);74 jSONPeople.put( "name", people.getNom() );75 jSONPeople.put( "firstName", people.getPrenom() );76 jSONPeople.put( "role", people.getRoles() );73 request.getSession().setAttribute( "SES_USER", user ); 74 jSONPeople.put( "name", user.getLastName() ); 75 jSONPeople.put( "firstName", user.getFirstName() ); 76 jSONPeople.put( "role", user.getRole().name() ); 77 77 } 78 78 } -
ether_megapoli/trunk/web/src/com/ether/ControllerEther.java
r278 r280 5 5 import com.ether.annotation.ParamName; 6 6 import com.ether.annotation.UseJSON; 7 import com. medias.annuaire.Personne;7 import com.ether.user.User; 8 8 import net.sf.json.JSON; 9 9 import net.sf.json.JSONArray; … … 88 88 if( methodDescription.isLoginMandatory() ) 89 89 { 90 final Personne pers = (Personne) request.getSession().getAttribute( "SES_USER" );91 params[params.length - 1] = pers;90 final User user = (User) request.getSession().getAttribute( "SES_USER" ); 91 params[params.length - 1] = user; 92 92 } 93 93
Note: See TracChangeset
for help on using the changeset viewer.