mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-20 19:59:54 +09:00
관리자 페이지 패키지별 UI 적용을 위한 1차 작업 마무리
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4616 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
856ab513ec
commit
ba4e9e26e2
248 changed files with 3520 additions and 3424 deletions
66
modules/ldap/ldap.model.php
Normal file
66
modules/ldap/ldap.model.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
/**
|
||||
* @class ldapModel
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief ldap 모듈의 Model class
|
||||
**/
|
||||
|
||||
class ldapModel extends ldap {
|
||||
|
||||
/**
|
||||
* @brief 초기화
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief LDAP 설정 정보 return
|
||||
**/
|
||||
function getConfig() {
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('ldap');
|
||||
if(!$config->ldap_port) $config->ldap_port = 389;
|
||||
if(!$config->ldap_email_entry) $config->ldap_email_entry = 'mail';
|
||||
if(!$config->ldap_nickname_entry) $config->ldap_nickname_entry = 'displayname';
|
||||
if(!$config->ldap_username_entry) $config->ldap_username_entry = 'description';
|
||||
if(!$config->ldap_group_entry) $config->ldap_group_entry = 'department';
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief LDAP 연동하여 정보를 return하는 method
|
||||
**/
|
||||
function ldap_conn($user_id, $password, $ldap_userdn_suffix, $base_dn, $ldap_server, $ldap_port = 389) {
|
||||
|
||||
if(!function_exists('ldap_connect')) return new Object(-1,'ldap module is not exists');
|
||||
|
||||
$ds = @ldap_connect($ldap_server, $ldap_port);
|
||||
if(!$ds) return new Object(-1,'server not connected');
|
||||
|
||||
if(!ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) return new Object(-1,'fail to set option');
|
||||
|
||||
$userdn = $user_id.$ldap_userdn_suffix;
|
||||
|
||||
if(!@ldap_bind($ds, $userdn, $password)) return new Object(-1,'fail to bind');
|
||||
|
||||
$ldap_sr = @ldap_search($ds, $base_dn, '(cn='.$user_id.')', array ('*'));
|
||||
if(!$ldap_sr) return new Object(-1,'fail to search');
|
||||
|
||||
$info = ldap_get_entries($ds, $ldap_sr);
|
||||
|
||||
if($info['count']<1 || !is_array($info) || !count($info[0]) ) return new Object(-1,'not found');
|
||||
|
||||
|
||||
$obj = new Object();
|
||||
foreach($info[0] as $key => $val) {
|
||||
if(preg_match('/^[0-9]*$/',$key) || $key == 'objectclass') continue;
|
||||
|
||||
$obj->add($key, $val[0]);
|
||||
}
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue