use of org.olat.modules.fo.Pseudonym in project OpenOLAT by OpenOLAT.
the class ForumManager method deletePseudonym.
public void deletePseudonym(Pseudonym pseudonym) {
Pseudonym reloadedPseudonym = dbInstance.getCurrentEntityManager().getReference(PseudonymImpl.class, pseudonym.getKey());
dbInstance.getCurrentEntityManager().remove(reloadedPseudonym);
}
use of org.olat.modules.fo.Pseudonym in project openolat by klemens.
the class MessageEditController method validatePseudonymProtected.
/**
* No password:
* <ul>
* <li>exists pseudonym with password: error</li>
* <li>doesn't exist pseudonym with passwort -> can use the pseudonym</li>
* </ul>
* With password:
* <ul>
* <li>exists pseudonym with password + password wrong: error</li>
* <li>exists pseudonym with password + password ok: ok</li>
* <li>exists pseudonym with password + password wrong: error</li>
* </ul>
*
* @param value
* @param password
* @return
*/
private boolean validatePseudonymProtected(String value, String password) {
boolean allOk = true;
if (StringHelper.containsNonWhitespace(password)) {
List<Pseudonym> pseudonyms = fm.getPseudonyms(value);
if (pseudonyms.size() > 0) {
boolean authenticated = false;
for (Pseudonym pseudonym : pseudonyms) {
if (fm.authenticatePseudonym(pseudonym, password)) {
authenticated = true;
break;
}
}
if (!authenticated) {
passwordEl.setErrorKey("error.pseudonym.authentication", null);
allOk &= false;
}
} else if (fm.isPseudonymInUseInForums(value)) {
pseudonymEl.setErrorKey("error.pseudonym", null);
allOk &= false;
}
} else if (fm.isPseudonymProtected(value)) {
pseudonymEl.setErrorKey("error.pseudonym.protected", null);
allOk &= false;
}
return allOk;
}
use of org.olat.modules.fo.Pseudonym in project openolat by klemens.
the class ForumPseudonymsAdminController method doDelete.
private void doDelete(PseudonymStatistics row) {
Pseudonym pseudonym = forumManager.getPseudonymByKey(row.getKey());
forumManager.deletePseudonym(pseudonym);
}
Aggregations