Ejemplo n.º 1
0
 /**
  * Checks if defined OLAT Properties in olatextconfig.xml exist in OLAT. Configuration: LDAP
  * Attributes Map = olatextconfig.xml (property=reqAttrs, property=userAttributeMapper)
  *
  * @param attrs Map of OLAT Properties from of the LDAP configuration
  * @return true All exist OK, false Error
  */
 private boolean checkIfOlatPropertiesExists(final Map<String, String> attrs) {
   final List<UserPropertyHandler> upHandler = userService.getAllUserPropertyHandlers();
   for (final String ldapAttribute : attrs.keySet()) {
     boolean propertyExists = false;
     final String olatProperty = attrs.get(ldapAttribute);
     if (olatProperty.equals(LDAPConstants.LDAP_USER_IDENTIFYER)) {
       // LDAP user identifyer is not a user propery, it's the username
       continue;
     }
     for (final UserPropertyHandler userPropItr : upHandler) {
       if (olatProperty.equals(userPropItr.getName())) {
         // ok, this property exist, continue with next one
         propertyExists = true;
         break;
       }
     }
     if (!propertyExists) {
       log.error(
           "Error in checkIfOlatPropertiesExists(): configured LDAP attribute::"
               + ldapAttribute
               + " configured to map to OLAT user property::"
               + olatProperty
               + " but no such user property configured in olat_userconfig.xml");
       return false;
     }
   }
   return true;
 }
Ejemplo n.º 2
0
 /**
  * Checks if defined Static OLAT Property in olatextconfig.xml exist in OLAT. Configuration:
  * olatextconfig.xml (property=staticUserProperties)
  *
  * @param olatProperties Set of OLAT Properties from of the LDAP configuration
  * @return true All exist OK, false Error
  */
 private boolean checkIfStaticOlatPropertiesExists(final Set<String> olatProperties) {
   final List<UserPropertyHandler> upHandler = userService.getAllUserPropertyHandlers();
   for (final String olatProperty : olatProperties) {
     boolean propertyExists = false;
     for (final UserPropertyHandler userPropItr : upHandler) {
       if (olatProperty.equals(userPropItr.getName())) {
         // ok, this property exist, continue with next one
         propertyExists = true;
         break;
       }
     }
     if (!propertyExists) {
       log.error(
           "Error in checkIfStaticOlatPropertiesExists(): configured static OLAT user property::"
               + olatProperty
               + " is not configured in olat_userconfig.xml");
       return false;
     }
   }
   return true;
 }