|
|
@ -103,11 +103,11 @@ public class LDAPSync implements Runnable {
|
|
|
|
_log.debug("Initiating LDAP Sync ...");
|
|
|
|
_log.debug("Initiating LDAP Sync ...");
|
|
|
|
createUsersOrganizationalUnit(ctx);
|
|
|
|
createUsersOrganizationalUnit(ctx);
|
|
|
|
|
|
|
|
|
|
|
|
//crate or update the whole list of organizations (objectClass=organizationalUnit, ou="+orgName+",dc=d4science,dc=org) and groups ( objectClass=top and POSIXGroup)
|
|
|
|
//update the users list
|
|
|
|
|
|
|
|
|
|
|
|
updateGroups(ctx, rootVO);
|
|
|
|
|
|
|
|
//and update the users list
|
|
|
|
|
|
|
|
exportSingleUsers(ctx, env, users);
|
|
|
|
exportSingleUsers(ctx, env, users);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//crate or update the whole list of organizations (objectClass=organizationalUnit, ou="+orgName+",dc=d4science,dc=org) and groups ( objectClass=top and POSIXGroup)
|
|
|
|
|
|
|
|
updateGroups(ctx, rootVO);
|
|
|
|
} catch (NamingException e) {
|
|
|
|
} catch (NamingException e) {
|
|
|
|
_log.error("Something went Wrong during LDAP Sync in Exporting to LDAP");
|
|
|
|
_log.error("Something went Wrong during LDAP Sync in Exporting to LDAP");
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
@ -134,6 +134,8 @@ public class LDAPSync implements Runnable {
|
|
|
|
attributes.put(description);
|
|
|
|
attributes.put(description);
|
|
|
|
// private static final String USER_CONTEXT = ",";
|
|
|
|
// private static final String USER_CONTEXT = ",";
|
|
|
|
ctx.createSubcontext("ou=Organizations,dc=d4science,dc=org", attributes);
|
|
|
|
ctx.createSubcontext("ou=Organizations,dc=d4science,dc=org", attributes);
|
|
|
|
|
|
|
|
_log.info("organizationalUnit \"ou=Organizations,dc=d4science,dc=org\" created");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
attributes = new BasicAttributes();
|
|
|
|
attributes = new BasicAttributes();
|
|
|
|
objectClass = new BasicAttribute("objectClass");
|
|
|
|
objectClass = new BasicAttribute("objectClass");
|
|
|
@ -141,6 +143,7 @@ public class LDAPSync implements Runnable {
|
|
|
|
attributes.put(objectClass);
|
|
|
|
attributes.put(objectClass);
|
|
|
|
description.add("Default Organization");
|
|
|
|
description.add("Default Organization");
|
|
|
|
ctx.createSubcontext("o=D4Science,ou=Organizations,dc=d4science,dc=org", attributes);
|
|
|
|
ctx.createSubcontext("o=D4Science,ou=Organizations,dc=d4science,dc=org", attributes);
|
|
|
|
|
|
|
|
_log.info("organizationalUnit \"o=D4Science,ou=Organizations,dc=d4science,dc=org\" created");
|
|
|
|
|
|
|
|
|
|
|
|
attributes = new BasicAttributes();
|
|
|
|
attributes = new BasicAttributes();
|
|
|
|
objectClass = new BasicAttribute("objectClass");
|
|
|
|
objectClass = new BasicAttribute("objectClass");
|
|
|
@ -148,6 +151,7 @@ public class LDAPSync implements Runnable {
|
|
|
|
attributes.put(objectClass);
|
|
|
|
attributes.put(objectClass);
|
|
|
|
description.add("People Org Unit");
|
|
|
|
description.add("People Org Unit");
|
|
|
|
ctx.createSubcontext("ou=People,o=D4Science,ou=Organizations,dc=d4science,dc=org", attributes);
|
|
|
|
ctx.createSubcontext("ou=People,o=D4Science,ou=Organizations,dc=d4science,dc=org", attributes);
|
|
|
|
|
|
|
|
_log.info("organizationalUnit \"ou=People,o=D4Science,ou=Organizations,dc=d4science,dc=org\" created");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
_log.info("ou=Organizations,dc=d4science,dc=org already present, skip");
|
|
|
|
_log.info("ou=Organizations,dc=d4science,dc=org already present, skip");
|
|
|
@ -175,7 +179,8 @@ public class LDAPSync implements Runnable {
|
|
|
|
//update the list of users in such VRE
|
|
|
|
//update the list of users in such VRE
|
|
|
|
updateUsersInGroup(ctx, vreSubCtx, vre);
|
|
|
|
updateUsersInGroup(ctx, vreSubCtx, vre);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_log.debug("LDAP Groups Sync Completed OK!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -201,7 +206,14 @@ public class LDAPSync implements Runnable {
|
|
|
|
Attributes attributes = new BasicAttributes();
|
|
|
|
Attributes attributes = new BasicAttributes();
|
|
|
|
attributes.put(memberUid);
|
|
|
|
attributes.put(memberUid);
|
|
|
|
ctx.modifyAttributes(vreSubCtx, DirContext.ADD_ATTRIBUTE, attributes);
|
|
|
|
ctx.modifyAttributes(vreSubCtx, DirContext.ADD_ATTRIBUTE, attributes);
|
|
|
|
_log.info("Adding user: " + user);
|
|
|
|
_log.info("Adding user as memberUid: " + user );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Attribute member = new BasicAttribute("member");
|
|
|
|
|
|
|
|
member.add(getSubContext(user));
|
|
|
|
|
|
|
|
Attributes attributes2 = new BasicAttributes();
|
|
|
|
|
|
|
|
attributes2.put(member);
|
|
|
|
|
|
|
|
ctx.modifyAttributes(vreSubCtx, DirContext.ADD_ATTRIBUTE, attributes2);
|
|
|
|
|
|
|
|
_log.info("Adding user as memberUid: " + user );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (javax.naming.directory.AttributeInUseException ex) {
|
|
|
|
catch (javax.naming.directory.AttributeInUseException ex) {
|
|
|
|
_log.trace("Not adding already existing user: " + user);
|
|
|
|
_log.trace("Not adding already existing user: " + user);
|
|
|
@ -259,9 +271,9 @@ public class LDAPSync implements Runnable {
|
|
|
|
|
|
|
|
|
|
|
|
Attribute objectClass = new BasicAttribute("objectClass");
|
|
|
|
Attribute objectClass = new BasicAttribute("objectClass");
|
|
|
|
objectClass.add("top");
|
|
|
|
objectClass.add("top");
|
|
|
|
|
|
|
|
objectClass.add("groupofnames");
|
|
|
|
objectClass.add("posixGroup");
|
|
|
|
objectClass.add("posixGroup");
|
|
|
|
// objectClass.add("researchProject");
|
|
|
|
//objectClass.add("nestedGroup");
|
|
|
|
// objectClass.add("groupOfMembers");
|
|
|
|
|
|
|
|
attributes.put(objectClass);
|
|
|
|
attributes.put(objectClass);
|
|
|
|
|
|
|
|
|
|
|
|
Attribute cn = new BasicAttribute("cn");
|
|
|
|
Attribute cn = new BasicAttribute("cn");
|
|
|
@ -363,6 +375,7 @@ public class LDAPSync implements Runnable {
|
|
|
|
objectClass.add("posixAccount");
|
|
|
|
objectClass.add("posixAccount");
|
|
|
|
objectClass.add("organizationalPerson");
|
|
|
|
objectClass.add("organizationalPerson");
|
|
|
|
objectClass.add("person");
|
|
|
|
objectClass.add("person");
|
|
|
|
|
|
|
|
objectClass.add("inetUser");
|
|
|
|
objectClass.add("shadowAccount");
|
|
|
|
objectClass.add("shadowAccount");
|
|
|
|
objectClass.add("ldapPublicKey");
|
|
|
|
objectClass.add("ldapPublicKey");
|
|
|
|
attributes.put(objectClass);
|
|
|
|
attributes.put(objectClass);
|
|
|
|