]> source.dussan.org Git - nextcloud-server.git/commitdiff
LDAP: check first whether group exists in this backend before doing other operations
authorArthur Schiwon <blizzz@owncloud.com>
Tue, 19 Mar 2013 10:52:35 +0000 (11:52 +0100)
committerArthur Schiwon <blizzz@owncloud.com>
Tue, 19 Mar 2013 10:52:35 +0000 (11:52 +0100)
apps/user_ldap/group_ldap.php

index efa5f8b4fe32d9f99eedc2c7231ce35661077568..3dbc5e7d895ce8d9a0e434d5bdedf0d6c302350e 100644 (file)
@@ -139,6 +139,9 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
                if(!$this->enabled) {
                        return array();
                }
+               if(!$this->groupExists($gid)) {
+                       return false;
+               }
                $cachekey = 'usersInGroup-'.$gid.'-'.$search.'-'.$limit.'-'.$offset;
                // check for cache of the exact query
                $groupUsers = $this->connection->getFromCache($cachekey);
@@ -214,6 +217,12 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
         * @returns array with display names (value) and user ids(key)
         */
        public function displayNamesInGroup($gid, $search, $limit, $offset) {
+               if(!$this->enabled) {
+                       return array();
+               }
+               if(!$this->groupExists($gid)) {
+                       return false;
+               }
                $users = $this->usersInGroup($gid, $search, $limit, $offset);
                $displayNames = array();
                foreach($users as $user) {