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