X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.ui%2Fsrc%2Forg%2Fargeo%2Fcms%2Futil%2FUserAdminUtils.java;h=f8c7a57209cb70cba96ca1e6a6d2a109d1d9b8d3;hb=5e5546ae33d363f1fab83f10f98c32eec6bfc3ca;hp=83f3d0042d42bb17b1869864959774b4b2e500a5;hpb=e7b05d237d09d176a627d26816717fb9f59c6011;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms.ui/src/org/argeo/cms/util/UserAdminUtils.java b/org.argeo.cms.ui/src/org/argeo/cms/util/UserAdminUtils.java index 83f3d0042..f8c7a5720 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/util/UserAdminUtils.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/util/UserAdminUtils.java @@ -51,8 +51,8 @@ public class UserAdminUtils { // OTHER USERS HELPERS /** - * Retrieves the local id of a user or group, that is respectively the uid - * or cn of the passed dn with no {@link UserAdmin} + * Retrieves the local id of a user or group, that is respectively the uid or cn + * of the passed dn with no {@link UserAdmin} */ public static String getUserLocalId(String dn) { LdapName ldapName = getLdapName(dn); @@ -65,8 +65,8 @@ public class UserAdminUtils { } /** - * Returns the local username if no user with this dn is found or if the - * found user has no defined display name + * Returns the local username if no user with this dn is found or if the found + * user has no defined display name */ public static String getUserDisplayName(UserAdmin userAdmin, String dn) { Role user = userAdmin.getRole(dn); @@ -97,8 +97,8 @@ public class UserAdminUtils { // LDAP NAMES HELPERS /** - * Easily retrieves one of the {@link Role}'s property or an empty String if - * the requested property is not defined + * Easily retrieves one of the {@link Role}'s property or an empty String if the + * requested property is not defined */ public final static String getProperty(Role role, String key) { Object obj = role.getProperties().get(key); @@ -108,9 +108,16 @@ public class UserAdminUtils { return ""; } + public final static String getProperty(Role role, Enum key) { + Object obj = role.getProperties().get(key.name()); + if (obj != null) + return (String) obj; + else + return ""; + } + /** - * Simply retrieves a LDAP name from a {@link LdapAttrs.DN} with no - * exception + * Simply retrieves a LDAP name from a {@link LdapAttrs.DN} with no exception */ private static LdapName getLdapName(String dn) { try {