You are here

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

Same name and namespace in other branches
  1. 8.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 563

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 = [
      '!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 [
    $message_type,
    $message_text,
  ];
}