Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncAD
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
江博文
syncAD
Commits
9120d903
Commit
9120d903
authored
Jan 27, 2022
by
jiangbowen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test conn
parent
b27708b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
15 deletions
+19
-15
LdapController.php
app/Http/Controllers/LdapController.php
+19
-15
No files found.
app/Http/Controllers/LdapController.php
View file @
9120d903
...
@@ -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'
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment