}
private Object getDatabaseUserMetaData(WGUserAccess userAccess, String name, String originalName) throws WGAPIException {
// Look if we have detailed user information
WGUserDetails userDetails = null;
if (userAccess instanceof WGUserDetails) {
userDetails = (WGUserDetails) userAccess;
}
if (name.equals("username")) {
return userAccess.getPrimaryName();
}
else if (name.equals("useraccess")) {
return new Integer(userAccess.getAccessLevel());
}
else if (name.startsWith("userlabel_") || name.startsWith("useralias_")) {
if (userDetails != null) {
int sublinePos = name.indexOf("_");
String label = originalName.substring(sublinePos + 1);
return userDetails.getLabeledNames().get(label);
}
else {
return null;
}
}
else if (name.equals("useraliases")) {
if (userDetails != null) {
return userDetails.getAliases();
}
else {
return null;
}
}
else if (name.equals("userroles")) {
if (userDetails != null) {
return userDetails.getRoles();
}
else {
return null;
}
}
else if (name.equals("usergroups")) {
if (userDetails != null) {
return userDetails.getGroups();
}
else {
return null;
}
}
else if (name.equals("useremail")) {
if (userDetails != null) {
return userDetails.getEMailAddress();
}
else {
return null;
}
}