robuster, hsadmin
This commit is contained in:
parent
ab010e0560
commit
9ea2f82a7b
@ -33,9 +33,15 @@ public class GroupsDAO {
|
||||
grp.setDn(result.getNameInNamespace());
|
||||
final List<String> listOfMembers = session.getListOfValues(attribs, "uniqueMember");
|
||||
final String dn = grp.getDn();
|
||||
listOfMembers.stream().map((userDN) -> users.get(userDN)).map((user) -> user.getGroups()).forEachOrdered((groups) -> {
|
||||
groups.add(dn);
|
||||
});
|
||||
for (final String userDN : listOfMembers) {
|
||||
final User user = users.get(userDN);
|
||||
if (user != null) {
|
||||
final List<String> groups = user.getGroups();
|
||||
groups.add(dn);
|
||||
} else {
|
||||
System.out.println("Error: " + userDN + " in group " + dn);
|
||||
}
|
||||
}
|
||||
grp.setMembers(listOfMembers);
|
||||
list.put(dn, grp);
|
||||
}
|
||||
|
@ -23,6 +23,8 @@ public class LDAPConfig {
|
||||
private String smtpHost;
|
||||
private String smtpPort;
|
||||
private String smtpInternalDomains;
|
||||
private String pacAdmin;
|
||||
private String pacPassword;
|
||||
private String tempDir;
|
||||
|
||||
private LDAPConfig() {
|
||||
@ -49,6 +51,8 @@ public class LDAPConfig {
|
||||
smtpPort = props.getProperty("smtp.port", smtpPort);
|
||||
smtpFromAddress = props.getProperty("smtp.from", smtpFromAddress);
|
||||
smtpInternalDomains = props.getProperty("smtp.internal", smtpInternalDomains);
|
||||
pacAdmin = props.getProperty("pac.user", "xyz00");
|
||||
pacPassword = props.getProperty("pac.password", "secret");
|
||||
tempDir = props.getProperty("temp.dir", tempDir);
|
||||
final LDAPUriParser uriParser = new LDAPUriParser(ldapProviderUrl);
|
||||
ldapDistinguishedName = uriParser.getDn();
|
||||
@ -119,6 +123,13 @@ public class LDAPConfig {
|
||||
return tempDir;
|
||||
}
|
||||
|
||||
public String getPacAdmin() {
|
||||
return pacAdmin;
|
||||
}
|
||||
|
||||
public String getPacPassword() {
|
||||
return pacPassword;
|
||||
}
|
||||
|
||||
private Properties loadConfig() throws IOException {
|
||||
final InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("config.properties");
|
||||
|
@ -71,11 +71,11 @@ public class UsersDAO {
|
||||
if (hasValue(emailInternal)) {
|
||||
mail.add(emailInternal);
|
||||
}
|
||||
attributes.put(mail);
|
||||
final String emailExternal = usr.getEmailExternal();
|
||||
if (hasValue(emailExternal)) {
|
||||
mail.add(emailExternal);
|
||||
attributes.put("description", emailExternal);
|
||||
}
|
||||
attributes.put(mail);
|
||||
attributes.put("uid", uid);
|
||||
attributes.put("cn", uid);
|
||||
final String telephone = usr.getPhone();
|
||||
|
@ -10,6 +10,7 @@ import javax.servlet.http.HttpSession;
|
||||
|
||||
import de.jalin.ldapadmin.beans.Group;
|
||||
import de.jalin.ldapadmin.beans.User;
|
||||
import de.jalin.ldapadmin.hsadmin.TicketProvider;
|
||||
import de.jalin.ldapadmin.ldap.LDAPConfig;
|
||||
import de.jalin.ldapadmin.ldap.LDAPSession;
|
||||
import de.jalin.ldapadmin.ldap.LDAPSessionException;
|
||||
@ -27,6 +28,7 @@ public class AbstractLDAPServlet extends HttpServlet {
|
||||
|
||||
protected LDAPSession ldapSession;
|
||||
protected LDAPConfig config;
|
||||
protected TicketProvider ticketProvider = null;
|
||||
|
||||
protected void loadData() {
|
||||
users = new TreeMap<>();
|
||||
@ -73,5 +75,14 @@ public class AbstractLDAPServlet extends HttpServlet {
|
||||
httpSession.removeAttribute("successmessage");
|
||||
httpSession.removeAttribute("servletexception");
|
||||
}
|
||||
|
||||
protected TicketProvider getTicketProvider() {
|
||||
if (ticketProvider == null) {
|
||||
final String pacAdmin = config.getPacAdmin();
|
||||
final String pacPassword = config.getPacPassword();
|
||||
ticketProvider = new TicketProvider(pacAdmin, pacPassword);
|
||||
}
|
||||
return ticketProvider;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,4 +3,5 @@ security.principal=uid=admin,ou=system
|
||||
security.password=streng-geheim
|
||||
smtp.host=localhost
|
||||
smtp.from=nobody@example.com
|
||||
smtp.internal=example.com,example.org
|
||||
pac.user=xyz00
|
||||
pac.password=secret
|
Loading…
Reference in New Issue
Block a user