View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0026809 | mantisbt | ldap | public | 2020-03-24 04:24 | 2025-01-18 16:20 |
| Reporter | maturbet | Assigned To | dregad | ||
| Priority | normal | Severity | feature | Reproducibility | always |
| Status | closed | Resolution | duplicate | ||
| Product Version | 2.24.0 | ||||
| Summary | 0026809: Personalize LDAP fields cached | ||||
| Description | To customize the list of ldap account fields to be cached for a user. Adding global variable : | ||||
| Additional Information | |||||
| Tags | No tags attached. | ||||
|
Som usage exemples exemple_ldap.txt (1,878 bytes)
<?php
#config/custom_constants_inc.php
define( 'CUSTOM_FIELD_TYPE_LDAP_LINK', 11 );
#config/config_inc.php
$g_custom_field_types[CUSTOM_FIELD_TYPE_LDAP_LINK] = 'standard';
$g_custom_field_type_enum_string = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio,10:textarea,11:ldaplink';
$g_custom_field_type_definition[CUSTOM_FIELD_TYPE_LDAP_LINK] = array (
'#display_possible_values' => FALSE,
'#display_valid_regexp' => FALSE,
'#display_length_min' => TRUE,
'#display_length_max' => TRUE,
'#display_default_value' => TRUE,
'#function_return_distinct_values' => null,
'#function_value_to_database' => null,
'#function_database_to_value' => null,
'#function_print_input' => 'cfdef_input_textbox',
'#function_string_value' => null,
'#function_string_value_for_email' => null,
'#function_default_to_value' => 'cfdef_get_ldap_value',
);
#config/custom_strings_inc.php
$s_custom_field_type_enum_string = '0:Chaîne de caractères,1:Nombre entier,2:Nombre réel,3:Énumération,4:Courriel,5:Case à cocher,6:Liste,7:Liste à sélection multiple,8:Date,9:Bouton radio, 10:Zone de texte,11:Lien LDAP';
#config/custom_functions_inc.php
/**
* Gets the field value from LDAP.
*
* @param string $p_value The LDAP field name.
* @return string The LDAP field value.
*/
function cfdef_get_ldap_value($p_value) {
return ldap_field(auth_get_current_user_id(), $p_value);
}
/**
* returns a field value from LDAP, given a userid.
*
* @param int $p_user_id The user id.
* @param string $p_value The LDAP field name.
* @return string $t_value The LDAP field value.
*/
function ldap_field( $p_user_id, $p_field_name) {
$t_username = user_get_field( $p_user_id, 'username' );
$t_value = ldap_get_field_from_username( $t_username, $p_field_name );
return $t_value;
}
|
|
|
*2 : (not implemented yet in internal plugin) : |
|
|
Closing as duplicate of 0035070. |
|