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
b6d299b4
Commit
b6d299b4
authored
Feb 16, 2022
by
张育槟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化保存接口功能
parent
83376d76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
LdapController.php
app/Http/Controllers/LdapController.php
+33
-0
No files found.
app/Http/Controllers/LdapController.php
View file @
b6d299b4
...
...
@@ -178,11 +178,44 @@ class LdapController extends Controller
public
function
editEmp
(
$data
)
{
if
(
empty
(
$data
))
return
;
$dept_name
=
''
;
if
(
!
empty
(
$data
[
'deptName'
])){
$ous
=
[];
$arr
=
explode
(
'/'
,
$data
[
'deptName'
]);
foreach
(
$arr
as
$key
=>
$v
)
{
$ous
[]
=
"ou=
{
$v
}
"
;
}
$ou_str
=
implode
(
','
,
array_reverse
(
$ous
));
$dept_name
=
$ou_str
;
}
foreach
(
$data
as
$key
=>
$value
)
{
if
(
is_numeric
(
$key
))
continue
;
$user
=
$this
->
provider
->
search
()
->
find
(
$key
);
if
(
$user
->
exists
)
{
$user
->
rename
(
"cn=
$value
"
);
$user
->
setDn
(
"cn=
{
$value
}
,
{
$dept_name
}
,ou=Users_hoto,dc=hoto,dc=test"
);
//在IT发展部新增人员
//邮箱
if
(
!
empty
(
$company_email
))
{
$user
->
setAttribute
(
'mail'
,
$company_email
);
}
//联系方式
if
(
!
empty
(
$mobileNumber
))
{
$user
->
setAttribute
(
'telephoneNumber'
,
$mobileNumber
);
}
//姓
if
(
!
empty
(
$first_name
))
{
$user
->
setAttribute
(
'sn'
,
$first_name
);
}
//名
if
(
!
empty
(
$last_name
))
{
$user
->
setAttribute
(
'givenName'
,
$last_name
);
}
//显示名称
$user
->
setAttribute
(
'displayName'
,
$value
);
//登陆账号
if
(
!
empty
(
$account
))
{
$user
->
setAttribute
(
'sAMAccountName'
,
$account
);
}
Log
::
info
(
"
{
$key
}
edit success...."
);
}
else
{
Log
::
info
(
"
{
$key
}
not exist...."
);
...
...
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