Commit 9120d903 authored by jiangbowen's avatar jiangbowen

test conn

parent b27708b5
...@@ -7,15 +7,19 @@ use Illuminate\Http\Request; ...@@ -7,15 +7,19 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
class LdapController extends Controller class LdapController extends Controller
{ {
public $host = '172.20.100.201';
public $dn = 'ou=Users_hoto,dc=hoto,dc=test';
public $username = 'hoto\hcmadmin';
public $password = 'hcmadmin123';
public $provider=null; public $provider=null;
public function __construct() public function __construct()
{ {
$ad = new \Adldap\Adldap(); $ad = new \Adldap\Adldap();
$config = [ $config = [
'hosts'=>["172.20.100.201"], 'hosts'=>[$this->host],
'base_dn'=>'ou=Users_hoto,dc=hoto,dc=test', 'base_dn'=>$this->dn,
'username' => 'hoto\hcmadmin', 'username' => $this->username,
'password' =>'hcmadmin123' 'password' =>$this->password
]; ];
$ad->addProvider($config); $ad->addProvider($config);
$this->provider = $ad->connect(); $this->provider = $ad->connect();
...@@ -45,20 +49,20 @@ class LdapController extends Controller ...@@ -45,20 +49,20 @@ class LdapController extends Controller
$data = [ $data = [
'operation_type'=>'dept', 'operation_type'=>'dept',
'operation'=>'add', 'operation'=>'add',
'data'=>['产品技术中心2/测试部2'] 'data'=>['产品技术中心2/测试部57']
]; ];
//编辑部门数据格式 //编辑部门数据格式
$data = [ // $data = [
'operation_type'=>'dept', // 'operation_type'=>'dept',
'operation'=>'edit', // 'operation'=>'edit',
'data'=>['产品技术中心2/测试部2'=>'产品技术中心/测试部35'] // 'data'=>['产品技术中心2/测试部2'=>'产品技术中心/测试部35']
]; // ];
//删除部门数据格式 //删除部门数据格式
$data = [ // $data = [
'operation_type'=>'dept', // 'operation_type'=>'dept',
'operation'=>'del', // 'operation'=>'del',
'data'=>['产品技术中心2/测试部35'] // 'data'=>['产品技术中心2/测试部35']
]; // ];
// var_dump($data); // var_dump($data);
if ($data['operation_type'] == 'emp') { if ($data['operation_type'] == 'emp') {
if ($data['operation'] == 'add') { if ($data['operation'] == 'add') {
......
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