pacdomain
This commit is contained in:
parent
96ce975aec
commit
e280c2a192
@ -160,6 +160,14 @@ public class Domain extends AbstractEntity {
|
||||
this.dnsMaster = dnsMaster;
|
||||
}
|
||||
|
||||
public boolean isPacDomain() {
|
||||
if (getUser() != null && getUser().getPac() != null) {
|
||||
String pacDomName = getUser().getPac().getName() + ".hostsharing.net";
|
||||
return pacDomName.equals(getName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNew() {
|
||||
return id == 0;
|
||||
|
@ -99,11 +99,9 @@ public class DomainModuleImpl extends AbstractModuleImpl {
|
||||
// search for domains superior to dom
|
||||
Query domainQuery = em.createQuery("SELECT d FROM Domains d WHERE d.name = :domainName");
|
||||
String superior = dom.getName();
|
||||
String prefix = null;
|
||||
while (superior.contains(".")) {
|
||||
prefix = superior.substring(0, superior.indexOf('.'));
|
||||
superior = superior.substring(superior.indexOf('.') + 1);
|
||||
if ("hostsharing.net".equals(superior) && admin.getName().equals(prefix)) {
|
||||
if (dom.isPacDomain()) {
|
||||
break;
|
||||
}
|
||||
domainQuery.setParameter("domainName", superior);
|
||||
@ -144,6 +142,10 @@ public class DomainModuleImpl extends AbstractModuleImpl {
|
||||
@Override
|
||||
public AbstractEntity update(AbstractEntity existingEntity) throws HSAdminException {
|
||||
Domain dom = (Domain) existingEntity;
|
||||
UnixUser loginUser = getTransaction().getLoginUser();
|
||||
if (dom.isPacDomain() && !loginUser.hasHostmasterRole()) {
|
||||
throw new AuthorisationException(loginUser, "update", existingEntity);
|
||||
}
|
||||
if (dom.getName() == null || dom.getName().length() == 0) {
|
||||
throw new HSAdminException("domain name required");
|
||||
}
|
||||
@ -158,7 +160,7 @@ public class DomainModuleImpl extends AbstractModuleImpl {
|
||||
dom.setUser((UnixUser) query.getSingleResult());
|
||||
}
|
||||
needsWriteAccessOn(existingEntity, "update");
|
||||
throw new AuthorisationException(getTransaction().getLoginUser(), "update", existingEntity);
|
||||
throw new AuthorisationException(loginUser, "update", existingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,7 +53,6 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
||||
for (String queueName : new String[] { "mail1", "mail2", "mail3" }) {
|
||||
mainProcessor.appendProcessor(queueName, createMailinSetupProcessor(domName, pac), queueName + ".hostsharing.net");
|
||||
}
|
||||
// mainProcessor.appendProcessor("backupmx", createBackupMXSetupProcessor(domName), "backupmx.hostsharing.net");
|
||||
templateVars = new HashMap<String, String>();
|
||||
templateVars.put("PAC", pacName);
|
||||
templateVars.put("HIVE", pac.getHiveName());
|
||||
@ -88,7 +87,6 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
||||
mainProcessor.appendProcessor(queueName, createMailinDeleteProcessor(domName), queueName + ".hostsharing.net");
|
||||
}
|
||||
mainProcessor.appendProcessor(dom.getHiveName(), createApacheVHostDeleteProcessor(dom), "remove apache vhost");
|
||||
// mainProcessor.appendProcessor("backupmx", createBackupMXDeleteProcessor(domName), "backupmx.hostsharing.net");
|
||||
return mainProcessor;
|
||||
}
|
||||
|
||||
@ -176,24 +174,11 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
||||
return mailQueueProcessor;
|
||||
}
|
||||
|
||||
private Processor createBackupMXSetupProcessor(String domName) {
|
||||
return new ShellProcessor("echo " + domName + " >> /etc/postfix/relaydomains" +
|
||||
" && invoke-rc.d postfix reload");
|
||||
}
|
||||
|
||||
private Processor createBackupMXDeleteProcessor(String domName) {
|
||||
Processor backupMXSMTPRelayDelProcessor =
|
||||
new ShellProcessor("grep -v '^" + domName + "$' /etc/postfix/relaydomains > /etc/postfix/relaydomains.tmp" +
|
||||
" && mv /etc/postfix/relaydomains.tmp /etc/postfix/relaydomains" +
|
||||
" && invoke-rc.d postfix reload");
|
||||
return backupMXSMTPRelayDelProcessor;
|
||||
}
|
||||
|
||||
private CompoundProcessor createDomainDirectoriesProcessor(Domain dom, Map<String, String> templateVars) throws ProcessorException {
|
||||
UnixUser domUser = dom.getUser();
|
||||
String domName = dom.getName();
|
||||
Pac pac = domUser.getPac();
|
||||
boolean dynamicWeb = pac.isDynamicWeb();
|
||||
boolean dynamicWeb = pac.isDynamicWeb() || dom.isPacDomain();
|
||||
String pacName = pac.getName();
|
||||
String homeDir = domUser.getHomedir();
|
||||
String domsDir = homeDir + "/doms";
|
||||
@ -287,7 +272,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
||||
if (domName.equals(pac.getName() + ".hostsharing.net")) {
|
||||
return "/de/hsadmin/mods/dom/httpd-vhost-dynamic.jtpl";
|
||||
}
|
||||
if (pac.isDynamicWeb()) {
|
||||
if (pac.isDynamicWeb() || dom.isPacDomain()) {
|
||||
return "/de/hsadmin/mods/dom/httpd-vhost-dynamic.jtpl";
|
||||
}
|
||||
return "/de/hsadmin/mods/dom/httpd-vhost-static.jtpl";
|
||||
|
@ -25,20 +25,18 @@ Login per SSH mit dem Kommandozeilen-Programm hsadmin eingerichtet
|
||||
oder mit dem Web-Client unter http://admin.hostsharing.net
|
||||
Dokumentation finden Sie unter:
|
||||
|
||||
<http://www.hostsharing.net/dokumentation.html>
|
||||
<http://wiki.hostsharing.net/>
|
||||
|
||||
Der Webspace des Paketes ist theoretisch ab sofort unter
|
||||
<http://{PAC}.hostsharing.net/> erreichbar, allerdings kann es durch
|
||||
DNS-Caches Verzoegerungen geben. Das DocumentRoot ist ~{PAC}/web, wobei
|
||||
~{PAC}/cgi als /cgi-bin in den Webspace eingeblendet wird. In SW Paketen
|
||||
darf dieses CGI nur fuer administrative Zwecke verwendet werden.
|
||||
DNS-Caches Verzoegerungen geben. Das DocumentRoot ist
|
||||
~{PAC}/doms/{PAC}.hostsharing.net/htdocs/ bzw.
|
||||
~{PAC}/doms/{PAC}.hostsharing.net/subs/www/
|
||||
In SW Paketen darf diese Domain nur fuer administrative Zwecke verwendet
|
||||
werden.
|
||||
|
||||
Die vorgenannte Paket-Subdomain ist jedoch eher zum Testen und Ausprobieren
|
||||
gedacht und hat mit dem folgenden Domain-Webspace nichts zu tun, der wird
|
||||
unter ~{PAC}/doms/ angelegt, sobald eine Domain aufgeschaltet wird. Dort gibt
|
||||
es dann fuer jede Domain ein separates Verzeichnis.
|
||||
|
||||
Das Verfahren zum Bestellen von Domains ist auf unserer Website unter
|
||||
Die vorgenannte Paket-Domain ist zum Testen und Ausprobieren gedacht.
|
||||
Das Verfahren zum Bestellen weiterer Domains ist auf unserer Website unter
|
||||
https://wiki.hostsharing.net/index.php?title=Domains
|
||||
beschrieben.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user