use of mom.trd.opentheso.bdd.helper.UserHelper in project opentheso by miledrousset.
the class CurrentUser method selectUser.
public void selectUser(NodeUser nu) {
nameEdit = nu.getName();
idEdit = nu.getId();
roleEdit = nu.getIdRole();
vue.setEditUser(true);
selectedThesaurus = new UserHelper().getAuthorizedThesaurus(connect.getPoolConnexion(), idEdit);
UserHelper userHelper = new UserHelper();
userEdit = userHelper.getInfoUser(connect.getPoolConnexion(), nameEdit, idTheso);
isActive = userEdit.isIsActive();
alertmail = userEdit.isIsAlertMail();
}
use of mom.trd.opentheso.bdd.helper.UserHelper in project opentheso by miledrousset.
the class CurrentUser method updateAuthorizedTheso.
public boolean updateAuthorizedTheso() {
UserHelper userHelper = new UserHelper();
authorizedTheso = userHelper.getAuthorizedThesaurus(connect.getPoolConnexion(), user.getId());
return true;
}
use of mom.trd.opentheso.bdd.helper.UserHelper in project opentheso by miledrousset.
the class CurrentUser method editUserRole.
public void editUserRole() {
UserHelper userHelper = new UserHelper();
try {
Connection conn = connect.getPoolConnexion().getConnection();
conn.setAutoCommit(false);
if (!userHelper.updateRoleUser(conn, idEdit, roleEdit, selectedThesaurus)) {
conn.rollback();
conn.close();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("error.BDD")));
return;
}
// permet de mettre à jour le status de l'utilisateur (actif ou pas)
if (!userHelper.updateStatusUser(conn, idEdit, isActive)) {
conn.rollback();
conn.close();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("error.BDD")));
return;
}
conn.commit();
conn.close();
} catch (SQLException ex) {
Logger.getLogger(CurrentUser.class.getName()).log(Level.SEVERE, null, ex);
return;
}
nameEdit = "";
vue.setEditUser(false);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("user.info4")));
}
use of mom.trd.opentheso.bdd.helper.UserHelper in project opentheso by miledrousset.
the class CurrentUser method changePwd.
public void changePwd() {
if (pwdEdit1 == null || pwdEdit1.equals("") || pwdEdit2 == null || pwdEdit2.equals("") || pwdEdit3 == null || pwdEdit3.equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("user.error2")));
} else if (!pwdEdit2.equals(pwdEdit3)) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("user.error3")));
} else if (!new UserHelper().isUserExist(connect.getPoolConnexion(), user.getName(), MD5Password.getEncodedPassword(pwdEdit1))) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("user.error4")));
} else {
new UserHelper().updatePwd(connect.getPoolConnexion(), user.getId(), MD5Password.getEncodedPassword(pwdEdit2));
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("user.info1")));
}
pwdEdit1 = "";
pwdEdit2 = "";
pwdEdit3 = "";
}
use of mom.trd.opentheso.bdd.helper.UserHelper in project opentheso by miledrousset.
the class ImportSkosHelper method addThesaurusToBdd.
/**
* cette fonction est privée, elle permet de créer le thésaurus dans la BDD et le role de l'utilisateur sur le thésaurus
* @return
*/
private boolean addThesaurusToBdd(ThesaurusHelper thesaurusHelper) {
try {
Connection conn = ds.getConnection();
conn.setAutoCommit(false);
String idTheso;
if (thesaurus.getLanguage() == null) {
thesaurus.setLanguage(langueSource);
}
if ((idTheso = thesaurusHelper.addThesaurusRollBack(conn, adressSite, useArk)) == null) {
conn.rollback();
conn.close();
return false;
}
thesaurus.setId_thesaurus(idTheso);
UserHelper userHelper = new UserHelper();
int idRole = userHelper.getRoleOfUser(ds, idUser);
if (!userHelper.addRole(conn, idUser, idRole, idTheso, "")) {
conn.rollback();
conn.close();
return false;
}
conn.commit();
conn.close();
return true;
} catch (SQLException ex) {
Logger.getLogger(ImportSkosHelper.class.getName()).log(Level.SEVERE, null, ex);
}
return false;
}
Aggregations