Commit c868894b authored by jiangbowen's avatar jiangbowen

test conn

parent b3b8f606
...@@ -40,6 +40,12 @@ class LdapController extends Controller ...@@ -40,6 +40,12 @@ class LdapController extends Controller
'operation_type'=>'emp', 'operation_type'=>'emp',
'operation'=>"del", 'operation'=>"del",
'data'=>['jiangbowen90912'] 'data'=>['jiangbowen90912']
];
//添加部门数据格式
$data = [
'operation_type'=>'dept',
'operation'=>'add',
'data'=>['产品技术中心/测试部']
]; ];
// var_dump($data); // var_dump($data);
if ($data['operation_type'] == 'emp') { if ($data['operation_type'] == 'emp') {
...@@ -127,7 +133,7 @@ class LdapController extends Controller ...@@ -127,7 +133,7 @@ class LdapController extends Controller
$ous[] = "ou={$value}"; $ous[] = "ou={$value}";
} }
$ou_str = implode(',',$ous); $ou_str = implode(',',$ous);
$result=$this->provider->search()->setDn("$ou_str,ou=department,dc=hoto,dc=test")->find($v); $result=$this->provider->search()->setDn("$ou_str,ou=IT发展部,ou=Users_hoto,dc=hoto,dc=test")->find($v);
// $dn = $result->getDnBuilder();->ous() // $dn = $result->getDnBuilder();->ous()
// $dn->addOu("$ou_str,ou=department,dc=test,dc=com"); // $dn->addOu("$ou_str,ou=department,dc=test,dc=com");
// var_dump($ou_str);die; // var_dump($ou_str);die;
...@@ -150,7 +156,7 @@ class LdapController extends Controller ...@@ -150,7 +156,7 @@ class LdapController extends Controller
$ous[] = "ou={$value}"; $ous[] = "ou={$value}";
} }
$ou_str = implode(',',$ous); $ou_str = implode(',',$ous);
$ou->setDn("$ou_str,ou=department,dc=test,dc=com"); $ou->setDn("$ou_str,ou=IT发展部,ou=Users_hoto,dc=hoto,dc=test");
if($ou->create()){ if($ou->create()){
Log::info("{$value} created success...."); Log::info("{$value} created success....");
} else { } else {
...@@ -169,7 +175,7 @@ class LdapController extends Controller ...@@ -169,7 +175,7 @@ class LdapController extends Controller
$ous[] = "ou={$v}"; $ous[] = "ou={$v}";
} }
$ou_str = implode(',',$ous); $ou_str = implode(',',$ous);
$result=$this->provider->search()->setDn("$ou_str,ou=department,dc=test,dc=com")->find($depts[count($depts)-1]); $result=$this->provider->search()->setDn("$ou_str,ou=IT发展部,ou=Users_hoto,dc=hoto,dc=test")->find($depts[count($depts)-1]);
if (is_null($result)) return; if (is_null($result)) return;
if ($result->exists) { if ($result->exists) {
$result->delete(); $result->delete();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment