small fixes, autoconfig option

This commit is contained in:
Peter Hormanns 2019-10-24 19:21:07 +02:00
parent 70acf77d37
commit ad95bf357b
10 changed files with 101 additions and 12 deletions

View File

@ -68,10 +68,11 @@ public class CustomerVO extends AbstractVO {
@ElementsType(SEPADirectDebitVO.class) @ElementsType(SEPADirectDebitVO.class)
@ReadWrite(ReadWritePolicy.READ) @ReadWrite(ReadWritePolicy.READ)
@Display(visible=DisplayPolicy.NEVER) @Display(visible=DisplayPolicy.OPTIONAL)
private List<SEPADirectDebitVO> sepaDirectDebits; private List<SEPADirectDebitVO> sepaDirectDebits;
@ReadWrite(ReadWritePolicy.READWRITE) @ReadWrite(ReadWritePolicy.READWRITE)
@Display(visible=DisplayPolicy.NEVER)
private final StringSet priceLists; private final StringSet priceLists;
public CustomerVO() throws TechnicalException { public CustomerVO() throws TechnicalException {

View File

@ -5,6 +5,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="hsar"> <persistence-unit name="hsar">
<jta-data-source>HsarDataSource</jta-data-source> <jta-data-source>HsarDataSource</jta-data-source>
<!--
<class>de.hsadmin.bo.customer.Contact</class> <class>de.hsadmin.bo.customer.Contact</class>
<class>de.hsadmin.bo.customer.Customer</class> <class>de.hsadmin.bo.customer.Customer</class>
<class>de.hsadmin.bo.customer.MemberShare</class> <class>de.hsadmin.bo.customer.MemberShare</class>
@ -22,5 +23,6 @@
<class>de.hsadmin.bo.pac.Pac</class> <class>de.hsadmin.bo.pac.Pac</class>
<class>de.hsadmin.bo.pac.PacComponent</class> <class>de.hsadmin.bo.pac.PacComponent</class>
<class>de.hsadmin.bo.pac.UnixUser</class> <class>de.hsadmin.bo.pac.UnixUser</class>
-->
</persistence-unit> </persistence-unit>
</persistence> </persistence>

View File

@ -0,0 +1,80 @@
package de.hsadmin.service.ldap;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Properties;
import javax.naming.AuthenticationException;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.StartTlsRequest;
import javax.naming.ldap.StartTlsResponse;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import de.hsadmin.common.config.Config;
import de.hsadmin.common.error.TechnicalException;
public class LDAPRead {
public static void main(String[] args) {
String ldapConnectString = "";
String bind = "";
String passwd = "";
try {
Config conf = Config.getInstance();
ldapConnectString = conf.getProperty("ldap.connect.url");
bind = conf.getProperty("ldap.connect.bind");
passwd = conf.getProperty("ldap.connect.password");
} catch (TechnicalException e) {
System.out.println(e.getLocalizedMessage());
return;
}
try {
try {
Thread.sleep(100L);
} catch (InterruptedException e1) {
}
final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put("com.sun.jndi.ldap.connect.pool", "true");
env.put(Context.PROVIDER_URL, ldapConnectString);
final InitialLdapContext ctx = new InitialLdapContext(env, null);
final StartTlsResponse tls = (StartTlsResponse) ctx.extendedOperation(new StartTlsRequest());
tls.negotiate();
ctx.addToEnvironment(Context.SECURITY_AUTHENTICATION, "simple");
String principal = bind;
ctx.addToEnvironment(Context.SECURITY_PRINCIPAL, principal);
ctx.addToEnvironment(Context.SECURITY_CREDENTIALS, passwd);
try {
ctx.reconnect(null);
String uid = "hsh-uwemueller";
final Attributes attributes = ctx.getAttributes("uid=" + uid + ",ou=users,ou=" + uid.substring(0, 3) + ",ou=customers");
System.out.println(attributes.get("nickName"));
} catch (AuthenticationException e) {
tls.close();
ctx.close();
System.out.println("Authentication failed " + e.getLocalizedMessage());
return;
}
tls.close();
ctx.close();
System.out.println("Success");
} catch (NamingException | IOException e) {
System.out.println("Authentication failed " + e.getLocalizedMessage());
}
}
}

View File

@ -37,7 +37,6 @@ public class CustomerPanel extends CustomComponent implements IHSPanel, Selected
final TabSheet tabsheet = new TabSheet(); final TabSheet tabsheet = new TabSheet();
tabsheet.setSizeFull(); tabsheet.setSizeFull();
tabsheet.addSelectedTabChangeListener(this); tabsheet.addSelectedTabChangeListener(this);
tabsheet.addSelectedTabChangeListener(this);
tabsheet.addTab(new GenericForm("customer", session, itemId, "name"), i18n.getText("customer")); tabsheet.addTab(new GenericForm("customer", session, itemId, "name"), i18n.getText("customer"));
final HSTab contactsTab = new HSTab("contact", session, "customer", itemId, "email"); final HSTab contactsTab = new HSTab("contact", session, "customer", itemId, "email");

View File

@ -26,8 +26,8 @@ public class DomainOptionsEditor extends CustomComponent implements IHSEditor {
"htdocsfallback", "htdocsfallback",
"includes", "includes",
"backupmxforexternalmx", "backupmxforexternalmx",
"letsencrypt"}; "letsencrypt",
// "phplatest"}; "autoconfig"};
private final PropertyInfo propertyInfo; private final PropertyInfo propertyInfo;
private final VerticalLayout layout; private final VerticalLayout layout;

View File

@ -31,6 +31,8 @@ public class DomainPanel extends CustomComponent implements IHSPanel, SelectedTa
{ {
final I18N i18n = session.getI18N(); final I18N i18n = session.getI18N();
final TabSheet tabsheet = new TabSheet(); final TabSheet tabsheet = new TabSheet();
tabsheet.setSizeFull();
tabsheet.addSelectedTabChangeListener(this);
tabsheet.addTab(new GenericForm("domain", session, itemId, "name"), i18n.getText("domain")); tabsheet.addTab(new GenericForm("domain", session, itemId, "name"), i18n.getText("domain"));
HSTab emailTab = new HSTab("emailaddress", session, "domain", itemId, "id"); HSTab emailTab = new HSTab("emailaddress", session, "domain", itemId, "id");
emailTab.fillTable(); emailTab.fillTable();

View File

@ -17,6 +17,7 @@ import de.hsadmin.model.TicketService;
import de.hsadmin.rpc.HSAdminSession; import de.hsadmin.rpc.HSAdminSession;
import de.hsadmin.rpc.PropertyInfo; import de.hsadmin.rpc.PropertyInfo;
import de.hsadmin.rpc.RpcException; import de.hsadmin.rpc.RpcException;
import de.hsadmin.rpc.enums.DisplayPolicy;
public class GenericForm extends CustomComponent { public class GenericForm extends CustomComponent {
@ -32,11 +33,14 @@ public class GenericForm extends CustomComponent {
final Iterator<PropertyInfo> iterator = session.getModulesManager().module(module).properties(); final Iterator<PropertyInfo> iterator = session.getModulesManager().module(module).properties();
while (iterator.hasNext()) { while (iterator.hasNext()) {
final PropertyInfo propertyInfo = iterator.next(); final PropertyInfo propertyInfo = iterator.next();
final String inputName = propertyInfo.getName(); final DisplayPolicy displayVisible = propertyInfo.getDisplayVisible();
final IEditorFactory editorFactory = FactoryProducer.getEditorFactory(session.getI18N(), module); if (DisplayPolicy.ALWAYS.equals(displayVisible)) {
final IHSEditor field = editorFactory.getEditor("view", propertyInfo); final String inputName = propertyInfo.getName();
inputFields.put(inputName, field); final IEditorFactory editorFactory = FactoryProducer.getEditorFactory(session.getI18N(), module);
formLayout.addComponent(field); final IHSEditor field = editorFactory.getEditor("view", propertyInfo);
inputFields.put(inputName, field);
formLayout.addComponent(field);
}
} }
setCompositionRoot(formLayout); setCompositionRoot(formLayout);

View File

@ -30,6 +30,7 @@ public class PackagePanel extends CustomComponent implements IHSPanel, SelectedT
public TabSheet createTabs(Object itemId) throws RpcException public TabSheet createTabs(Object itemId) throws RpcException
{ {
final TabSheet tabsheet = new TabSheet(); final TabSheet tabsheet = new TabSheet();
tabsheet.setSizeFull();
tabsheet.addSelectedTabChangeListener(this); tabsheet.addSelectedTabChangeListener(this);
tabsheet.addTab(new GenericForm("pac", session, itemId, "name"), session.getI18N().getText("pac")); tabsheet.addTab(new GenericForm("pac", session, itemId, "name"), session.getI18N().getText("pac"));
final HSTab usersTab = new HSTab("user", session, "pac", itemId, "name"); final HSTab usersTab = new HSTab("user", session, "pac", itemId, "name");

View File

@ -40,7 +40,7 @@ domainoption.htdocsfallback=htdocsfallback
domainoption.includes=includes domainoption.includes=includes
domainoption.backupmxforexternalmx=backupmxforexternalmx domainoption.backupmxforexternalmx=backupmxforexternalmx
domainoption.letsencrypt=letsencrypt domainoption.letsencrypt=letsencrypt
# domainoption.phplatest=PHP 7.3 domainoption.autoconfig=email autoconfig and autodiscover
mysqluser.name=MySql username mysqluser.name=MySql username
mysqluser.instance=MySql instance mysqluser.instance=MySql instance
mysqluser.pac=MySql package mysqluser.pac=MySql package

View File

@ -40,7 +40,7 @@ domainoption.htdocsfallback=Fallback auf htdocs/htdocs-ssl
domainoption.includes=Includes domainoption.includes=Includes
domainoption.backupmxforexternalmx=Backup-MX für externen Mailserver domainoption.backupmxforexternalmx=Backup-MX für externen Mailserver
domainoption.letsencrypt=Let's Encrypt-Zertifikat domainoption.letsencrypt=Let's Encrypt-Zertifikat
# domainoption.phplatest=PHP 7.3 domainoption.autoconfig=E-Mail Auto-Konfiguration
mysqluser.name=MySQL-Benutzer mysqluser.name=MySQL-Benutzer
mysqluser.instance=Datenbanksystem mysqluser.instance=Datenbanksystem
mysqluser.pac=Web-Paket mysqluser.pac=Web-Paket