public static void addUserToLDAP(SysUser user) throws EasyJException {
LDAPConnection connection = new LDAPConnection();
try {
LDAPAttributeSet attributeSet = new LDAPAttributeSet();
attributeSet.add(new LDAPAttribute("objectclass", new String[] {
"pilotPerson", "uidObject"
}));
attributeSet.add(new LDAPAttribute("uid", user.getUserName()));
attributeSet.add(new LDAPAttribute("userPassword", user
.getPassword()));
attributeSet.add(new LDAPAttribute("mail", user.getEmail()));
attributeSet.add(new LDAPAttribute("sn", "snMass"));
attributeSet.add(new LDAPAttribute("cn", "cnMass"));
LDAPEntry entry = new LDAPEntry("uid=" + user.getUserName()
+ ",ou=People,o=SEForge,dc=sei,dc=pku", attributeSet);
connection.connect(LDAPServerAddress, 389);
connection.bind(LDAPConnection.LDAP_V3, "cn=admin,dc=sei,dc=pku",
"seiseforge");