From 53344baf011973a382aee89a240fb02912c8405b Mon Sep 17 00:00:00 2001 From: skeeter Date: Sun, 21 Apr 2002 17:42:40 +0000 Subject: [PATCH] GNU Patch #246. --- phpgwapi/inc/class.accounts_contacts.inc.php | 21 +++++++++++++------ phpgwapi/inc/class.accounts_ldap.inc.php | 21 +++++++++++++------ phpgwapi/inc/class.accounts_sql.inc.php | 22 ++++++++++++++------ 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/phpgwapi/inc/class.accounts_contacts.inc.php b/phpgwapi/inc/class.accounts_contacts.inc.php index 2d27462265..0c2f5d56aa 100644 --- a/phpgwapi/inc/class.accounts_contacts.inc.php +++ b/phpgwapi/inc/class.accounts_contacts.inc.php @@ -331,14 +331,23 @@ if (!$default_acls) { + $apps = Array( + 'addressbook', + 'calendar', + 'email', + 'notes', + 'todo', + 'phpwebhosting', + 'manual' + ); + $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 1)",__LINE__,__FILE__); $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('phpgw_group', '1', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('addressbook', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('filemanager', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('calendar', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 1)",__LINE__,__FILE__); + @reset($apps); + while(list($key,$app) = each($apps)) + { + $this->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('".$app."', 'run', ".$accountid.", 1)",__LINE__,__FILE__); + } } $this->db->transaction_commit(); return $accountid; diff --git a/phpgwapi/inc/class.accounts_ldap.inc.php b/phpgwapi/inc/class.accounts_ldap.inc.php index 130c61b23a..e56e345bb4 100644 --- a/phpgwapi/inc/class.accounts_ldap.inc.php +++ b/phpgwapi/inc/class.accounts_ldap.inc.php @@ -740,6 +740,16 @@ $this->db->transaction_begin(); if($default_acls == False) { + $apps = Array( + 'addressbook', + 'calendar', + 'email', + 'notes', + 'todo', + 'phpwebhosting', + 'manual' + ); + $default_group_lid = $GLOBALS['phpgw_info']['server']['default_group_lid']; $default_group_id = $this->name2id($default_group_lid); $defaultgroupid = $default_group_id ? $default_group_id : $this->name2id('Default'); @@ -749,12 +759,11 @@ . $defaultgroupid . ", " . $accountid . ", 1)",__LINE__,__FILE__); } $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('addressbook', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('filemanager', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('calendar', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 1)",__LINE__,__FILE__); + @reset($apps); + while(list($key,$app) = each($apps)) + { + $this->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('".$app."', 'run', ".$accountid.", 1)",__LINE__,__FILE__); + } } $this->db->transaction_commit(); return $accountid; diff --git a/phpgwapi/inc/class.accounts_sql.inc.php b/phpgwapi/inc/class.accounts_sql.inc.php index 647b098641..3868ca2580 100644 --- a/phpgwapi/inc/class.accounts_sql.inc.php +++ b/phpgwapi/inc/class.accounts_sql.inc.php @@ -357,12 +357,22 @@ // If they dont have a default group, they need some sort of permissions. // This generally doesn't / shouldn't happen, but will (jengo) $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('preferences', 'changepassword', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('addressbook', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('filemanager', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('calendar', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 1)",__LINE__,__FILE__); - $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 1)",__LINE__,__FILE__); + + $apps = Array( + 'addressbook', + 'calendar', + 'email', + 'notes', + 'todo', + 'phpwebhosting', + 'manual' + ); + + @reset($apps); + while(list($key,$app) = each($apps)) + { + $this->db->query("INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) VALUES ('".$app."', 'run', ".$accountid.", 1)",__LINE__,__FILE__); + } } } $this->db->transaction_commit();