HSAdmin Backend Domains, E-Mail, Datenbanken
Purodha Blissenbach
2012-09-21 001946a6d0ce76cfa8524d0f0c37f4c8a0b334fa
Fix fatal error setting default domain options for newly created domain.
1 files modified
14 ■■■■ changed files
hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java 14 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java
@@ -96,9 +96,19 @@
        DomainOption domainOption = new DomainOption();
        domainOption.setName("greylisting");
        domainOptions.add(domainOption);
        dom.setDomainoptions(domainOptions);
        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);
        UnixUser loginUser = getTransaction().getLoginUser();
        if (!loginUser.hasHostmasterRole()) {