Importing a native user
You can import the existing
native LDAP users as Verify Identity Access users.
The native LDAP user information must be obtained as an
RgyUser instance,
then the RgyUser.importNativeGroup() method can be
invoked. The following example imports a Default native
user as a Verify Identity Access user testuser from
the native LDAP entry. Last parameter of deleteUser() is
set to true. / First fetch the Native Entity
String userNativeId = "cn=testuser,o=ibm,c=us”;
RgyUser rgyUser = null;
try {
rgyUser = rgyRegistry.getNativeUser(“Default”, userNativeId);
}
catch (RgyException e) {
e.printStackTrace();
System.exit(1);
}
// Ensure the Native user was found
if (rgyUser == null) {
System.out.println(“Group does not exist”);
System.exit(1);
}
// Only import, if not already a TAM user (isSecEntity=FALSE)
String isSecEntity = (String) rgyUser.getOneAttributeValue
(RgyAttributes. IS_SEC_ENTITY_NAME);
if (isSecEntity.equalsIgnoreCase(RgyAttributes. BOOL_FALSE_VALUE)) {
String userId = "testuser";
RgyAttributes rgyAttributes = rgyRegistry.newRgyAttributes();
// Setup an optional attribute
rgyAttributes.putAttribute(RgyAttributes.SEC_ACCT_VALID_NAME,
RgyAttributes.BOOL_TRUE_VALUE);
try {
rgyUser.importNativeUser(userId, rgyAttributes, null);
}
catch (RgyException e) {
e.printStackTrace();
System.exit(1);
}
}