mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-18 08:19:05 +01:00
LSaddon::posix : added generate_memberUidFromUniqueMember() function
This commit is contained in:
parent
9ba2f8591b
commit
350aff50c1
2 changed files with 28 additions and 1 deletions
|
@ -59,4 +59,7 @@ define('LS_POSIX_HOMEDIRECTORY_FTP_PWD','password');
|
||||||
// Create homeDirectory by FTP - Path
|
// Create homeDirectory by FTP - Path
|
||||||
define('LS_POSIX_HOMEDIRECTORY_FTP_PATH','%{homeDirectory}');
|
define('LS_POSIX_HOMEDIRECTORY_FTP_PATH','%{homeDirectory}');
|
||||||
|
|
||||||
|
// Pattern to transform user DN to uid
|
||||||
|
define('LS_POSIX_DN_TO_UID_PATTERN','/^'.LS_POSIX_UID_ATTR.'=([^,]*),.*$/');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -66,7 +66,8 @@ LSerror :: defineError('POSIX_01',
|
||||||
'LS_POSIX_HOMEDIRECTORY_FTP_PORT',
|
'LS_POSIX_HOMEDIRECTORY_FTP_PORT',
|
||||||
'LS_POSIX_HOMEDIRECTORY_FTP_USER',
|
'LS_POSIX_HOMEDIRECTORY_FTP_USER',
|
||||||
'LS_POSIX_HOMEDIRECTORY_FTP_PWD',
|
'LS_POSIX_HOMEDIRECTORY_FTP_PWD',
|
||||||
'LS_POSIX_HOMEDIRECTORY_FTP_PATH'
|
'LS_POSIX_HOMEDIRECTORY_FTP_PATH',
|
||||||
|
'LS_POSIX_DN_TO_UID_PATTERN',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($MUST_DEFINE_CONST as $const) {
|
foreach($MUST_DEFINE_CONST as $const) {
|
||||||
|
@ -210,5 +211,28 @@ function generateMemberFromMemberUid($ldapObject) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generate_memberUidFromUniqueMember($ldapObject) {
|
||||||
|
if ( get_class($ldapObject -> attrs[ 'memberUid' ]) != 'LSattribute' ) {
|
||||||
|
LSerror :: addErrorCode('POSIX_01',array('dependency' => 'memberUid', 'attr' => 'memberUid'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( get_class($ldapObject -> attrs[ 'uniqueMember' ]) != 'LSattribute' ) {
|
||||||
|
LSerror :: addErrorCode('POSIX_01',array('dependency' => 'uniqueMember', 'attr' => 'memberUid'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dns = $ldapObject -> attrs[ 'uniqueMember' ] -> getValue();
|
||||||
|
$uids = array();
|
||||||
|
if (is_array($dns)) {
|
||||||
|
foreach($dns as $dn) {
|
||||||
|
if(preg_match(LS_POSIX_DN_TO_UID_PATTERN,$dn,$matches)) {
|
||||||
|
$uids[]=$matches[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $uids;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue