packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/ldap.php
changeset 4 2212b2ded8bf
parent 3 a044870a9d3d
child 8 f68fdcc18df9
equal deleted inserted replaced
3:a044870a9d3d 4:2212b2ded8bf
    28 
    28 
    29 $ldap_add_multiple = array(
    29 $ldap_add_multiple = array(
    30 		'telephoneNumber'
    30 		'telephoneNumber'
    31 		, 'mobile'
    31 		, 'mobile'
    32 		, 'mail'
    32 		, 'mail'
       
    33 		, 'sshPublicKey'
    33 	);
    34 	);
    34 
    35 
    35 // END CONSTANTS
    36 // END CONSTANTS
    36 
    37 
    37 global $_ldapconn;
    38 global $_ldapconn;
   132 	return $results;
   133 	return $results;
   133 }
   134 }
   134 
   135 
   135 function ldap_array_cleanup($arr)
   136 function ldap_array_cleanup($arr)
   136 {
   137 {
       
   138 	global $ldap_add_multiple;
       
   139 	
   137 	$result = array();
   140 	$result = array();
   138 	foreach ( $arr as $k => $v )
   141 	foreach ( $arr as $k => $v )
   139 	{
   142 	{
   140 		if ( is_int($k) || $k == 'count' )
   143 		if ( is_int($k) || $k == 'count' )
   141 			continue;
   144 			continue;
   142 		
   145 		
   143 		if ( $v['count'] === 1 )
   146 		if ( $v['count'] === 1 && !in_array($k, $ldap_add_multiple) )
   144 			$v = $v[0];
   147 			$v = $v[0];
   145 		else
   148 		else
   146 			unset($v['count']);
   149 			unset($v['count']);
   147 		
   150 		
   148 		$result[$k] = $v;
   151 		$result[$k] = $v;
   302 				'top'
   305 				'top'
   303 				, 'person'
   306 				, 'person'
   304 				, 'inetOrgPerson'
   307 				, 'inetOrgPerson'
   305 				, 'organizationalPerson'
   308 				, 'organizationalPerson'
   306 				, 'posixAccount'
   309 				, 'posixAccount'
       
   310 				, 'ldapPublicKey'
   307 				)
   311 				)
   308 			, 'gn' => array($gn)
   312 			, 'gn' => array($gn)
   309 			, 'sn' => array($sn)
   313 			, 'sn' => array($sn)
   310 			, 'userPassword' => array("{SASL}$username@$krb_realm")
   314 			, 'userPassword' => array("{SASL}$username@$krb_realm")
   311 			, 'loginShell' => array('/bin/bash')
   315 			, 'loginShell' => array('/bin/bash')