[Openupload-svn-update] SF.net SVN: openupload:[312] trunk/lib/modules/auth/ldap.inc.php
Status: Beta
Brought to you by:
tsdogs
|
From: <ts...@us...> - 2009-05-01 22:53:48
|
Revision: 312
http://openupload.svn.sourceforge.net/openupload/?rev=312&view=rev
Author: tsdogs
Date: 2009-05-01 22:53:46 +0000 (Fri, 01 May 2009)
Log Message:
-----------
AD was not working anymore.
needs testing with LDAP.
Modified Paths:
--------------
trunk/lib/modules/auth/ldap.inc.php
Modified: trunk/lib/modules/auth/ldap.inc.php
===================================================================
--- trunk/lib/modules/auth/ldap.inc.php 2009-05-01 22:52:33 UTC (rev 311)
+++ trunk/lib/modules/auth/ldap.inc.php 2009-05-01 22:53:46 UTC (rev 312)
@@ -53,14 +53,13 @@
}
function userinfo($login) {
-
$result = array();
if ($this->connect() and $this->bind()) {
$r = @ldap_search($this->ds, $this->config['userdn'],
'(&('.$this->ufield.'='.$login.')(objectclass='.$this->config['userclass'].'))');
if ($r) {
$res = @ldap_get_entries($this->ds, $r);
- /* associate user fields */echo '<pre>';
+ /* associate user fields */;
$res = $res[0];
foreach ($this->config['userfields'] as $n => $f) {
if ($f == 'group_id') {
@@ -70,24 +69,33 @@
}
}
}
- /* now retrieve the main group */
- for ($g = 0; $g < $result['group_id']['count']; $g++) {
- $r = @ldap_search($this->ds, $this->config['groupdn'],
- '(&('.$this->gfield.'='.$result['group_id'][$g].')(objectclass='.$this->config['groupclass'].'))');
- if ($r) {
- $res = @ldap_get_entries($this->ds, $r);
- /* associate user fields */
- $res = $res[0];
- foreach ($this->config['groupfields'] as $n => $f) {
- if ($f == 'name' and $res[$n][0]!='') {
- $result['group'][] = $res[$n][0];
+ if ($this->config['type']!='AD') {
+ /* now retrieve the main group */
+ for ($g = 0; $g < $result['group_id']['count']; $g++) {
+ $r = @ldap_search($this->ds, $this->config['groupdn'],
+ '(&('.$this->gfield.'='.$result['group_id'][$g].')(objectclass='.$this->config['groupclass'].'))');
+ if ($r) {
+ $res = @ldap_get_entries($this->ds, $r);
+ /* associate user fields */
+ $res = $res[0];
+ foreach ($this->config['groupfields'] as $n => $f) {
+ if ($f == 'name' and $res[$n][0]!='') {
+ $result['group'][] = $res[$n][0];
+ }
}
}
}
+ } else {
+ $result['group'][0] = app()->config['register']['default_group'];
+ $this->config['sgid'] = $this->config['gid'];
+ $this->config['sgroupfields'] = $this->config['groupfields'];
}
+
if (isset($this->config['sgid'])) {
- $r = @ldap_search($this->ds, $this->config['groupdn'],
- '(&('.$this->config['sgid'].'='.$result['login'].')(objectclass='.$this->config['groupclass'].'))');
+ if ($this->config['type']!='AD')
+ $result['uid'] = $result['login'];
+ $filter = '(&('.$this->config['sgid'].'='.$result['uid'].')(objectclass='.$this->config['groupclass'].'))';
+ $r = @ldap_search($this->ds, $this->config['groupdn'], $filter);
if ($r) {
$res = @ldap_get_entries($this->ds, $r);
for ($i = 0; $i<$res['count']; $i++) {
@@ -130,4 +138,4 @@
}
-?>
\ No newline at end of file
+?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|