diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2012-06-01 13:49:11 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2012-06-01 14:05:08 +0200 |
commit | 86279bc192d72318540e312e637f9ecceb339a77 (patch) | |
tree | c29326d788a1310685f3834bd0e2fc04f522d431 /apps | |
parent | 0468f53f7311291ce78125d684184c1c7ae0756f (diff) | |
download | nextcloud-server-86279bc192d72318540e312e637f9ecceb339a77.tar.gz nextcloud-server-86279bc192d72318540e312e637f9ecceb339a77.zip |
LDAP group backend: If a group filter is not configured, do not do anything. Fixes oc-867
Diffstat (limited to 'apps')
-rw-r--r-- | apps/user_ldap/group_ldap.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php index b3ff6c53881..2c16bf312f8 100644 --- a/apps/user_ldap/group_ldap.php +++ b/apps/user_ldap/group_ldap.php @@ -25,10 +25,15 @@ class OC_GROUP_LDAP extends OC_Group_Backend { // //group specific settings protected $ldapGroupFilter; protected $ldapGroupMemberAssocAttr; + protected $configured = false; public function __construct() { $this->ldapGroupFilter = OCP\Config::getAppValue('user_ldap', 'ldap_group_filter', '(objectClass=posixGroup)'); $this->ldapGroupMemberAssocAttr = OCP\Config::getAppValue('user_ldap', 'ldap_group_member_assoc_attribute', 'uniqueMember'); + + if(empty($this->ldapGroupFilter) || empty($this->ldapGroupMemberAssocAttr)) { + $this->configured = false; + } } /** @@ -40,6 +45,9 @@ class OC_GROUP_LDAP extends OC_Group_Backend { * Checks whether the user is member of a group or not. */ public function inGroup($uid, $gid) { + if(!$this->configured) { + return false; + } $dn_user = OC_LDAP::username2dn($uid); $dn_group = OC_LDAP::groupname2dn($gid); // just in case @@ -79,6 +87,9 @@ class OC_GROUP_LDAP extends OC_Group_Backend { * if the user exists at all. */ public function getUserGroups($uid) { + if(!$this->configured) { + return array(); + } $userDN = OC_LDAP::username2dn($uid); if(!$userDN) { return array(); @@ -111,6 +122,10 @@ class OC_GROUP_LDAP extends OC_Group_Backend { * @returns array with user ids */ public function usersInGroup($gid) { + if(!$this->configured) { + return array(); + } + $groupDN = OC_LDAP::groupname2dn($gid); if(!$groupDN) { return array(); @@ -149,6 +164,10 @@ class OC_GROUP_LDAP extends OC_Group_Backend { * Returns a list with all groups */ public function getGroups() { + if(!$this->configured) { + return array(); + } + $ldap_groups = OC_LDAP::fetchListOfGroups($this->ldapGroupFilter, array(OC_LDAP::conf('ldapGroupDisplayName'), 'dn')); $groups = OC_LDAP::ownCloudGroupNames($ldap_groups); return $groups; |