rename subdomains column

This commit is contained in:
Peter Hormanns 2017-06-21 17:48:25 +02:00
parent 187bddaf8d
commit 0e59e02ef0
4 changed files with 16 additions and 10 deletions

View File

@ -2,10 +2,10 @@ INSERT INTO domain_option (domain_option_name)
VALUES ('letsencrypt'); VALUES ('letsencrypt');
ALTER TABLE domain ALTER TABLE domain
ADD COLUMN cert_dns_alt_names CHARACTER VARYING(512); ADD COLUMN valid_subdomain_names CHARACTER VARYING(512);
UPDATE domain UPDATE domain
SET cert_dns_alt_names = domain_name || ',www.' || domain_name ; SET valid_subdomain_names = '*' ;
INSERT INTO contactrole_ref (contact_id, role) INSERT INTO contactrole_ref (contact_id, role)
( SELECT contact_id, 'voting-right' FROM contact ); ( SELECT contact_id, 'voting-right' FROM contact );

View File

@ -62,8 +62,8 @@ public class Domain extends AbstractEntity {
inverseJoinColumns={@JoinColumn(name="domain_option_id", referencedColumnName="domain_option_id")}) inverseJoinColumns={@JoinColumn(name="domain_option_id", referencedColumnName="domain_option_id")})
private Set<DomainOption> domainoptions; private Set<DomainOption> domainoptions;
@Column(name = "cert_dns_alt_names", columnDefinition = "character varying(512)") @Column(name = "valid_subdomain_names", columnDefinition = "character varying(512)")
private String certDNSAltNames; private String validSubdomainNames;
public Domain() { public Domain() {
} }
@ -182,12 +182,12 @@ public class Domain extends AbstractEntity {
this.domainoptions = domainOptions; this.domainoptions = domainOptions;
} }
public String getCertDNSAltNames() { public String getValidSubdomainNames() {
return certDNSAltNames; return validSubdomainNames;
} }
public void setCertDNSAltNames(String certDNSAltNames) { public void setValidSubdomainNames(String validSubdomainNames) {
this.certDNSAltNames = certDNSAltNames; this.validSubdomainNames = validSubdomainNames;
} }
} }

View File

@ -181,8 +181,8 @@ public class DomainModuleImpl extends AbstractModuleImpl {
} }
dom.setDomainoptions(domainOptions); dom.setDomainoptions(domainOptions);
} }
if (dom.getCertDNSAltNames() == null) { if (dom.getValidSubdomainNames() == null) {
dom.setCertDNSAltNames(domName + ",www." + domName); dom.setValidSubdomainNames("www");
} }
if (dom.isPacDomain()) { if (dom.isPacDomain()) {
em.persist(new EMailAddress("owner", "", dom, dom.getUser().getPac().getCustomer().getName().substring(6) + "@hostsharing.net")); em.persist(new EMailAddress("owner", "", dom, dom.getUser().getPac().getCustomer().getName().substring(6) + "@hostsharing.net"));

View File

@ -47,6 +47,8 @@ public class DomainRemote extends AbstractRemote {
domainOptionsList.add(opt.getName()); domainOptionsList.add(opt.getName());
} }
} }
final String validsubdomains = dom.getValidSubdomainNames();
resultMap.put("validsubdomains", validsubdomains);
} }
@Override @Override
@ -73,6 +75,10 @@ public class DomainRemote extends AbstractRemote {
} }
dom.setDomainoptions(domainOptionsSet); dom.setDomainoptions(domainOptionsSet);
} }
final Object validsubdomains = setParams.get("validsubdomains");
if (validsubdomains != null && validsubdomains instanceof String) {
dom.setValidSubdomainNames((String) validsubdomains);
}
} }
@Override @Override