From 7d55dcca99c6ffccaf34a64f0bd5a6c2e04b9fa2 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 15 May 2014 19:30:46 +0000 Subject: [PATCH] support users/groups without correct object class on Windows --- lam/lib/modules/posixAccount.inc | 12 ++++++++++++ lam/lib/modules/posixGroup.inc | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index 9420fd4f..ce4a11bc 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -2723,6 +2723,9 @@ class posixAccount extends baseModule implements passwordService { } $typeSettings = $_SESSION['config']->get_typeSettings(); $filter = '(objectClass=posixGroup)'; + if ($this->isWindows()) { + $filter = '(&(objectClass=group)(gidNumber=*))'; + } if (!empty($typeSettings['filter_group'])) { $typeFilter = $typeSettings['filter_group']; if (strpos($typeFilter, '(') !== 0) { @@ -3105,6 +3108,15 @@ class posixAccount extends baseModule implements passwordService { return !$this->manageCn(); } + /** + * Returns if the Windows module is active. + * + * @return boolean is Windows + */ + private function isWindows() { + return !$this->manageCn(); + } + /** * Returns the password attribute. * Usually, this is userPassword. If Windows modules are active this is unixUserPassword. diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index 500cb622..295ec400 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -1075,6 +1075,9 @@ class posixGroup extends baseModule implements passwordService { } $typeSettings = $_SESSION['config']->get_typeSettings(); $filter = '(&(objectClass=posixAccount)(gidNumber=*))'; + if ($this->isWindows()) { + $filter = '(&(objectClass=user)(gidNumber=*))'; + } if (!empty($typeSettings['filter_user'])) { $typeFilter = $typeSettings['filter_user']; if (strpos($typeFilter, '(') !== 0) { @@ -1126,6 +1129,24 @@ class posixGroup extends baseModule implements passwordService { 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; + } + } ?>