Showing user details
The following example displays the user details such as User ID, Native ID, Common name, Surname,
and descriptive name.
RgyUser rgyUser = null;
try {
rgyUser = registry.getUser(null, userId);
}
catch (RgyException e) {
e.printStackTrace();
System.exit(1);
}
if (rgyUser == null) {
System.out.println(“User not found”);
System.exit(1);
}
System.out.println(“Login ID: “+rgyUser.getId());
System.out.println(“LDAP DN: “+rgyUser.getNativeId());
System.out.println(“LDAP CN: “+rgyUer.getOneAttributeValue
(RgyAttributes.COMMON_NAME_NAME);
System.out.println(“LDAP SN: “+rgyUser.getOneAttributeValue
(RgyAttributes.SURNAME_NAME);
String description = (String) rgyUser.getOneAttributeValue
(RgyAttributes.DESCRIPTION_NAME);
if (description == null) {
description = “”;
}
System.out.println(“Description: “+description);
System.out.println(“Is SecUser: “+yesNo
(rgyUser, RgyAttributes. IS_SEC_ENTITY_NAME);
System.out.println(“Is GSO user: “+yesNo
(rgyUser, RgyAttributes. IS_GSO_USER_NAME));
System.out.println(“Account valid: “+yesNo
(rgyUser, RgyAttributes. SEC_ACCT_VALID_NAME));
System.out.println(“Password valid: “+yesNo
(rgyUser, RgyAttributes. SEC_PWD_VALID_NAME));
//-----
String yesNo(RgyEntity rgyEntity, String attributeName)
{
String value = (String) rgyGroup.getOneAttributeValue(attributeName);
if (value.equalsCaseIgnore(RgyAttributes. BOOL_TRUE_VALUE)) {
value = “Yes”;
}
else {
value = “No”;
}
return value;
}