You are here

public function LdapAuthorizationConsumerOG::validateAuthorizationMappingTarget in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7.2 ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php \LdapAuthorizationConsumerOG::validateAuthorizationMappingTarget()
  2. 7 ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php \LdapAuthorizationConsumerOG::validateAuthorizationMappingTarget()

Overrides LdapAuthorizationConsumerAbstract::validateAuthorizationMappingTarget

See also

ldapAuthorizationConsumerAbstract::validateAuthorizationMappingTarget

File

ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php, line 778

Class

LdapAuthorizationConsumerOG

Code

public function validateAuthorizationMappingTarget($mapping, $form_values = NULL, $clear_cache = FALSE) {

  // these mappings have already been through the normalizeMappings() method, so no real querying needed here.
  $has_form_values = is_array($form_values);
  $message_type = NULL;
  $message_text = NULL;
  $pass = !empty($mapping['valid']) && $mapping['valid'] === TRUE;

  /**
   * @todo need to look this over
   *
   */
  if (!$pass) {
    $tokens = array(
      '!from' => $mapping['from'],
      '!user_entered' => $mapping['user_entered'],
      '!error' => $mapping['error_message'],
    );
    $message_text = '<code>"' . t('!map_to|!user_entered', $tokens) . '"</code> ' . t('has the following error: !error.', $tokens);
  }
  return array(
    $message_type,
    $message_text,
  );
}