Fix fatal error setting default domain options for newly created domain.
This commit is contained in:
parent
6bda687298
commit
001946a6d0
@ -96,10 +96,20 @@ public class DomainModuleImpl extends AbstractModuleImpl {
|
||||
DomainOption domainOption = new DomainOption();
|
||||
domainOption.setName("greylisting");
|
||||
domainOptions.add(domainOption);
|
||||
EntityManager em = getTransaction().getEntityManager();
|
||||
Query q = em.createQuery("SELECT opt FROM " +
|
||||
DomainOption.class.getAnnotation(javax.persistence.Entity.class).name() +
|
||||
" opt WHERE opt.name=:optName");
|
||||
for (DomainOption opt : domainOptions) {
|
||||
q.setParameter("optName", opt.getName());
|
||||
List<?> list = q.getResultList();
|
||||
if (list.size() != 1) {
|
||||
throw new HSAdminException("invalid domain option: " + opt.getName());
|
||||
} else {
|
||||
opt.setId(((DomainOption) list.get(0)).getId());
|
||||
}
|
||||
dom.setDomainoptions(domainOptions);
|
||||
|
||||
EntityManager em = getTransaction().getEntityManager();
|
||||
|
||||
UnixUser loginUser = getTransaction().getLoginUser();
|
||||
if (!loginUser.hasHostmasterRole()) {
|
||||
// search for domains superior to dom
|
||||
|
Loading…
Reference in New Issue
Block a user