From cc7020f9a69a5189e59d5de408840b2b8e610dea Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 8 Jul 2006 21:38:54 +0000 Subject: [PATCH] fixed sql error in setup/account_migration, as there are no grants, if there's no user --- addressbook/inc/class.socontacts.inc.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/addressbook/inc/class.socontacts.inc.php b/addressbook/inc/class.socontacts.inc.php index 9d9c3835a3..90497d4313 100755 --- a/addressbook/inc/class.socontacts.inc.php +++ b/addressbook/inc/class.socontacts.inc.php @@ -193,11 +193,14 @@ class socontacts $this->contact_repository = 'ldap'; $this->somain =& CreateObject('addressbook.so_ldap'); - // static grants from ldap: all rights for the own personal addressbook and the group ones of the meberships - $this->grants = array($this->user => ~0); - foreach($this->memberships as $gid) + if ($this->user) // not set eg. in setup { - $this->grants[$gid] = ~0; + // static grants from ldap: all rights for the own personal addressbook and the group ones of the meberships + $this->grants = array($this->user => ~0); + foreach($this->memberships as $gid) + { + $this->grants[$gid] = ~0; + } } $this->columns_to_search = $this->ldap_search_attributes; } @@ -208,9 +211,13 @@ class socontacts $this->contact_repository = 'sql-ldap'; } $this->somain =& CreateObject('addressbook.socontacts_sql'); - // group grants are now grants for the group addressbook and NOT grants for all its members, therefor the param false! - $this->grants = $GLOBALS['egw']->acl->get_grants($contact_app,false); - + + if ($this->user) // not set eg. in setup + { + // group grants are now grants for the group addressbook and NOT grants for all its members, + // therefor the param false! + $this->grants = $GLOBALS['egw']->acl->get_grants($contact_app,false); + } // remove some columns, absolutly not necessary to search in sql $this->columns_to_search = array_diff(array_values($this->somain->db_cols),$this->sql_cols_not_to_search); }