[Castore-commits] FlatAuthentification.java 1.1.2.2 1.1.2.3
Stéphane Bouchet
sbouchet at adullact1.hosting.cri74.org
Lun 6 Mar 13:30:52 CET 2006
Update of /cvsroot/castore/castore-core/src/java/fr/emn/castor/users/authentification
In directory adullact1:/tmp/cvs-serv24731/src/java/fr/emn/castor/users/authentification
Modified Files:
Tag: v1_1_branch
FlatAuthentification.java
Log Message:
implemantation de la fonction isvalidateur()
Index: FlatAuthentification.java
===================================================================
RCS file: /cvsroot/castore/castore-core/src/java/fr/emn/castor/users/authentification/FlatAuthentification.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** FlatAuthentification.java 21 Dec 2005 17:43:12 -0000 1.1.2.2
--- FlatAuthentification.java 6 Mar 2006 12:30:50 -0000 1.1.2.3
***************
*** 45,49 ****
import java.util.Collection;
import java.util.HashMap;
- import java.util.List;
import java.util.Map;
--- 45,48 ----
***************
*** 51,55 ****
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
- import javax.xml.transform.TransformerException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
--- 50,53 ----
***************
*** 128,132 ****
// Read the entire document into memory
this.document = parser.parse(userFile);
! // création du XPath
this.xpath = XPathFactory.newInstance().newXPath();
} catch (SAXException saxe) {
--- 126,130 ----
// Read the entire document into memory
this.document = parser.parse(userFile);
! // création du XPath
this.xpath = XPathFactory.newInstance().newXPath();
} catch (SAXException saxe) {
***************
*** 150,156 ****
/**
! * @see fr.emn.castor.users.authentification.AuthentificationFactory#authentifieUtilisateur(java.lang.String, java.lang.String)
*/
! public Map authentifieUtilisateur(
final String identifiant, final String motDePasse)
throws AuthentificationException {
--- 148,155 ----
/**
! * @see fr.emn.castor.users.authentification.AuthentificationFactory#
! * authentifieUtilisateur(java.lang.String, java.lang.String)
*/
! public final Map authentifieUtilisateur(
final String identifiant, final String motDePasse)
throws AuthentificationException {
***************
*** 239,260 ****
/**
! * @see fr.emn.castor.users.authentification.AuthentificationFactory#isValidateur(java.lang.String)
*/
public boolean isValidateur(final String login)
throws AuthentificationException {
! // TODO Auto-generated method stub
! return false;
}
/**
! * @see fr.emn.castor.users.authentification.AuthentificationFactory#searchUser(java.lang.String)
*/
public Collection searchUser(final String query)
throws AuthentificationException {
// on doit chercher le ou les utilisateurs dans le fichier plat fourni
! ArrayList results = new ArrayList();
NodeList nodeList = null;
try {
-
XPathExpression exp = this.xpath
.compile("//user[@nom[contains(.,'" + query + "')]]");
--- 238,281 ----
/**
! * @see fr.emn.castor.users.authentification.AuthentificationFactory#
! * isValidateur(java.lang.String)
*/
public boolean isValidateur(final String login)
throws AuthentificationException {
! boolean result = false;
! try {
! XPathExpression exp = this.xpath.compile("//user[@username='"
! + login + "']");
! Node node = (Node) exp.evaluate(
! this.document, XPathConstants.NODE);
! if (node == null) {
! throw new AuthentificationException(
! "Utilisateur inconnu",
! AuthentificationException.NO_USER_FOUND);
! }
! if (!(node.getAttributes().getNamedItem("role").equals("user"))) {
! result = true;
! }
! } catch (XPathExpressionException e) {
! if (log.isErrorEnabled()) {
! log.error("Erreur de recherche d'utilisateur, login : "
! + login, e);
! }
! throw new AuthentificationException(
! e.getMessage(), AuthentificationException.NO_USER_FOUND);
! }
! return result;
}
/**
! * @see fr.emn.castor.users.authentification.AuthentificationFactory#
! * searchUser(java.lang.String)
*/
public Collection searchUser(final String query)
throws AuthentificationException {
// on doit chercher le ou les utilisateurs dans le fichier plat fourni
! ArrayList<HashMap> results = new ArrayList<HashMap>();
NodeList nodeList = null;
try {
XPathExpression exp = this.xpath
.compile("//user[@nom[contains(.,'" + query + "')]]");
***************
*** 262,271 ****
this.document, XPathConstants.NODESET);
for (int i = 0; i < nodeList.getLength(); i++) {
! Node node = (Node) nodeList.item(i);
String tutorLogin = node.getAttributes().getNamedItem(
"username").getNodeValue();
String tutorName = node
.getAttributes().getNamedItem("nom").getNodeValue();
! HashMap result = new HashMap();
result.put(UsersConstants.SEARCH_TUTOR_LOGIN, tutorLogin);
result.put(UsersConstants.SEARCH_TUTOR_NAME, tutorName);
--- 283,292 ----
this.document, XPathConstants.NODESET);
for (int i = 0; i < nodeList.getLength(); i++) {
! Node node = nodeList.item(i);
String tutorLogin = node.getAttributes().getNamedItem(
"username").getNodeValue();
String tutorName = node
.getAttributes().getNamedItem("nom").getNodeValue();
! HashMap<String, String> result = new HashMap<String, String>();
result.put(UsersConstants.SEARCH_TUTOR_LOGIN, tutorLogin);
result.put(UsersConstants.SEARCH_TUTOR_NAME, tutorName);
***************
*** 284,288 ****
/**
! * @see fr.emn.castor.users.authentification.AuthentificationFactory#getInfosFromUser(java.lang.String)
*/
public Map getInfosFromUser(final String user)
--- 305,310 ----
/**
! * @see fr.emn.castor.users.authentification.AuthentificationFactory#
! * getInfosFromUser(java.lang.String)
*/
public Map getInfosFromUser(final String user)
Plus d'informations sur la liste de diffusion Castore-commits