HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2019-07-29 b137b45b381f04903e72b255d62b5a794cf0f4bb
fix list of all dns zones
1 files modified
27 ■■■■■ changed files
hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java 27 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
@@ -1,5 +1,6 @@
package de.hsadmin.mods.pac;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -50,6 +51,7 @@
                createMakePacDirectoryStructure(unixUser),
                createIfUp(pac),
                createHttpdVirtualProc(hive),
                createDNSServerConfigProcessor(em),
                createAccountingRulesProc());
        } else {
            return new NullProcessor();
@@ -279,6 +281,31 @@
        );
    }
    private Processor createDNSServerConfigProcessor(EntityManager em) {
        final HashMap<String, Object> templateVars = new HashMap<String, Object>();
        final Query pacsQuery = em.createQuery("SELECT p FROM Pacs p WHERE p.basepac.name = 'PAC/WEB'");
        final List<?> pacsList = pacsQuery.getResultList();
        templateVars.put("pacs", pacsList);
        final Query domsQuery = em.createQuery("SELECT d FROM Domains d");
        final List<?> domsList = domsQuery.getResultList();
        final List<Domain> filteredDomsList = new ArrayList<Domain>();
        for (final Object listElement : domsList) {
            if (listElement instanceof Domain) {
                final Domain d = (Domain) listElement;
                if (!d.isPacDomain()) {
                    filteredDomsList.add(d);
                }
            }
        }
        templateVars.put("domains", filteredDomsList);
        return new CompoundProcessor(
            new VelocityProcessor("/de/hsadmin/mods/dom/named-hsh-conf.vm",
                        templateVars, "/etc/bind/named-hsh.conf.tmp", true),
            new ShellProcessor(" ( diff -q /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf && rm /etc/bind/named-hsh.conf.tmp ) " +
                    "|| ( mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf && invoke-rc.d bind9 reload )")
        );
    }
    private UnixUser getPacAdminUser(Pac pac) throws ProcessorException {
        UnixUser unixUser = null;
        Set<UnixUser> unixUserSet = pac.getUnixUser();