Fixes
This commit is contained in:
parent
6bb368fb37
commit
3cc04662ba
@ -55,7 +55,7 @@ public class EMailAddress extends AbstractEntity implements Serializable {
|
|||||||
@JoinColumn(name = "domain_id", columnDefinition = "integer", updatable = false)
|
@JoinColumn(name = "domain_id", columnDefinition = "integer", updatable = false)
|
||||||
private Domain domain;
|
private Domain domain;
|
||||||
|
|
||||||
@FieldValidation("[a-zA-Z0-9\\_\\-\\.\\|\\\"\\/\\@\\,\\+]*")
|
@FieldValidation("[a-zA-Z0-9\\_\\-\\.\\|\\\"\\/\\@\\,\\+\\ ]*")
|
||||||
@Column(name = "target", nullable= false)
|
@Column(name = "target", nullable= false)
|
||||||
private String target;
|
private String target;
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ public class EMailAddressModuleImpl extends AbstractModuleImpl {
|
|||||||
EMailAddress detachedAddr = (EMailAddress) existingEntity;
|
EMailAddress detachedAddr = (EMailAddress) existingEntity;
|
||||||
EntityManager em = getTransaction().getEntityManager();
|
EntityManager em = getTransaction().getEntityManager();
|
||||||
EMailAddress attachedAddr = em.find(EMailAddress.class, detachedAddr.getId());
|
EMailAddress attachedAddr = em.find(EMailAddress.class, detachedAddr.getId());
|
||||||
Domain domain = detachedAddr.getDomain();
|
String domain = detachedAddr.getDomain().getName();
|
||||||
if (domain != null && domain.getId() != attachedAddr.getDomain().getId()) {
|
if (domain != null && !domain.equals(attachedAddr.getDomain().getName())) {
|
||||||
detachedAddr.setDomain(attachedAddr.getDomain());
|
detachedAddr.setDomain(attachedAddr.getDomain());
|
||||||
throw new AuthorisationException(getLoginUser(), "update", detachedAddr, "domain");
|
throw new AuthorisationException(getLoginUser(), "update", detachedAddr, "domain");
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import static javax.persistence.GenerationType.SEQUENCE;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
@ -76,23 +77,17 @@ public class EMailAlias extends AbstractEntity implements Serializable {
|
|||||||
String pacName = name.substring(0, 5);
|
String pacName = name.substring(0, 5);
|
||||||
try {
|
try {
|
||||||
// get the entities name (query part from FROM to WHERE)
|
// get the entities name (query part from FROM to WHERE)
|
||||||
javax.persistence.Entity entityAnnot = Pac.class
|
Entity entityAnnot = Pac.class.getAnnotation(Entity.class);
|
||||||
.getAnnotation(javax.persistence.Entity.class);
|
String queryString = "SELECT obj FROM " + entityAnnot.name() + " obj WHERE " + Pac.createQueryFromStringKey(pacName);
|
||||||
String queryString = "FROM " + entityAnnot.name() + " WHERE "
|
|
||||||
+ Pac.createQueryFromStringKey(pacName);
|
|
||||||
|
|
||||||
// set parameters
|
// set parameters
|
||||||
Query query = em.createQuery(queryString);
|
Query query = em.createQuery(queryString);
|
||||||
AbstractModuleImpl.setQueryParameter(query, queryString,
|
AbstractModuleImpl.setQueryParameter(query, queryString, "loginUser", loginUser);
|
||||||
"loginUser", loginUser);
|
AbstractModuleImpl.setQueryParameter(query, queryString, "loginUserName", loginUser.getName());
|
||||||
AbstractModuleImpl.setQueryParameter(query, queryString,
|
AbstractModuleImpl.setQueryParameter(query, queryString, "loginUserPac", loginUser.getPac());
|
||||||
"loginUserName", loginUser.getName());
|
|
||||||
AbstractModuleImpl.setQueryParameter(query, queryString,
|
|
||||||
"loginUserPac", loginUser.getPac());
|
|
||||||
pac = (Pac) query.getSingleResult();
|
pac = (Pac) query.getSingleResult();
|
||||||
} catch (NoResultException exc) {
|
} catch (NoResultException exc) {
|
||||||
throw new SecurityException("packet '" + pacName
|
throw new SecurityException("packet '" + pacName + "' not found or access denied");
|
||||||
+ "' not found or access denied");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user