Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
ba29aad7
Commit
ba29aad7
authored
14 years ago
by
Dominik Eckelmann
Committed by
Adrian Lang
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
gather additional information from ad backend
parent
274409ef
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inc/auth/ad.class.php
+24
-2
24 additions, 2 deletions
inc/auth/ad.class.php
with
24 additions
and
2 deletions
inc/auth/ad.class.php
+
24
−
2
View file @
ba29aad7
...
...
@@ -26,6 +26,10 @@
* $conf['auth']['ad']['use_ssl'] = 1;
* $conf['auth']['ad']['debug'] = 1;
*
* // get additional informations to the userinfo array
* // add a list of comma separated ldap contact fields.
* $conf['auth']['ad']['additional'] = 'field1,field2';
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author James Van Lommel <jamesvl@gmail.com>
* @link http://www.nosq.com/blog/2005/08/ldap-activedirectory-and-dokuwiki/
...
...
@@ -47,6 +51,12 @@ class auth_ad extends auth_basic {
global
$conf
;
$this
->
cnf
=
$conf
[
'auth'
][
'ad'
];
// additional information fields
if
(
isset
(
$this
->
cnf
[
'additional'
]))
{
$this
->
cnf
[
'additional'
]
=
str_replace
(
' '
,
''
,
$this
->
cnf
[
'additional'
]);
$this
->
cnf
[
'additional'
]
=
explode
(
','
,
$this
->
cnf
[
'additional'
]);
}
else
$this
->
cnf
[
'additional'
]
=
array
();
// ldap extension is needed
if
(
!
function_exists
(
'ldap_connect'
))
{
if
(
$this
->
cnf
[
'debug'
])
...
...
@@ -131,15 +141,27 @@ class auth_ad extends auth_basic {
global
$conf
;
if
(
!
$this
->
_init
())
return
false
;
//get info for given user
$result
=
$this
->
adldap
->
user_info
(
$user
);
$fields
=
array
(
'mail'
,
'displayname'
,
'samaccountname'
);
// add additional fields to read
$fields
=
array_merge
(
$fields
,
$this
->
cnf
[
'additional'
]);
$fields
=
array_unique
(
$fields
);
//get info for given user
$result
=
$this
->
adldap
->
user_info
(
$user
,
$fields
);
//general user info
$info
[
'name'
]
=
$result
[
0
][
'displayname'
][
0
];
$info
[
'mail'
]
=
$result
[
0
][
'mail'
][
0
];
$info
[
'uid'
]
=
$result
[
0
][
'samaccountname'
][
0
];
$info
[
'dn'
]
=
$result
[
0
][
'dn'
];
// additional informations
foreach
(
$this
->
cnf
[
'additional'
]
as
$field
)
{
if
(
isset
(
$result
[
0
][
strtolower
(
$field
)]))
{
$info
[
$field
]
=
$result
[
0
][
strtolower
(
$field
)][
0
];
}
}
// handle ActiveDirectory memberOf
$info
[
'grps'
]
=
$this
->
adldap
->
user_groups
(
$user
,(
bool
)
$this
->
opts
[
'recursive_groups'
]);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment