support users/groups without correct object class on Windows

This commit is contained in:
Roland Gruber 2014-05-15 19:30:46 +00:00
parent 5814dc495b
commit 7d55dcca99
2 changed files with 33 additions and 0 deletions

View File

@ -2723,6 +2723,9 @@ class posixAccount extends baseModule implements passwordService {
} }
$typeSettings = $_SESSION['config']->get_typeSettings(); $typeSettings = $_SESSION['config']->get_typeSettings();
$filter = '(objectClass=posixGroup)'; $filter = '(objectClass=posixGroup)';
if ($this->isWindows()) {
$filter = '(&(objectClass=group)(gidNumber=*))';
}
if (!empty($typeSettings['filter_group'])) { if (!empty($typeSettings['filter_group'])) {
$typeFilter = $typeSettings['filter_group']; $typeFilter = $typeSettings['filter_group'];
if (strpos($typeFilter, '(') !== 0) { if (strpos($typeFilter, '(') !== 0) {
@ -3105,6 +3108,15 @@ class posixAccount extends baseModule implements passwordService {
return !$this->manageCn(); return !$this->manageCn();
} }
/**
* Returns if the Windows module is active.
*
* @return boolean is Windows
*/
private function isWindows() {
return !$this->manageCn();
}
/** /**
* Returns the password attribute. * Returns the password attribute.
* Usually, this is userPassword. If Windows modules are active this is unixUserPassword. * Usually, this is userPassword. If Windows modules are active this is unixUserPassword.

View File

@ -1075,6 +1075,9 @@ class posixGroup extends baseModule implements passwordService {
} }
$typeSettings = $_SESSION['config']->get_typeSettings(); $typeSettings = $_SESSION['config']->get_typeSettings();
$filter = '(&(objectClass=posixAccount)(gidNumber=*))'; $filter = '(&(objectClass=posixAccount)(gidNumber=*))';
if ($this->isWindows()) {
$filter = '(&(objectClass=user)(gidNumber=*))';
}
if (!empty($typeSettings['filter_user'])) { if (!empty($typeSettings['filter_user'])) {
$typeFilter = $typeSettings['filter_user']; $typeFilter = $typeSettings['filter_user'];
if (strpos($typeFilter, '(') !== 0) { if (strpos($typeFilter, '(') !== 0) {
@ -1126,6 +1129,24 @@ class posixGroup extends baseModule implements passwordService {
return $this->cachedGroupNameList; return $this->cachedGroupNameList;
} }
/**
* Returns if the Windows module is active.
*
* @return boolean is Windows
*/
private function isWindows() {
if (isset($_SESSION['config'])) {
$conf = $_SESSION['config'];
if (in_array('windowsGroup', $conf->get_AccountModules($this->get_scope()))) {
return true;
}
else {
return false;
}
}
return false;
}
} }
?> ?>