From 542bb68597b5c39ac251af17ff7ad7e0201de62c Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Thu, 1 Mar 2001 16:10:16 +0000 Subject: [PATCH] Fix acl calls, especially not giving run perms to non-admins --- setup/ldap.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/setup/ldap.php b/setup/ldap.php index 6dc646e81c..3397ba9631 100644 --- a/setup/ldap.php +++ b/setup/ldap.php @@ -63,7 +63,7 @@ } $phpgw_setup->db->query("select app_name,app_title from phpgw_applications where app_enabled != '0' and " - . "app_name != 'admin'",__LINE__,__FILE__); + . "app_name != 'administration'",__LINE__,__FILE__); while ($phpgw_setup->db->next_record()) { $apps[$phpgw_setup->db->f("app_name")] = $phpgw_setup->db->f("app_title"); } @@ -84,27 +84,31 @@ @reset($s_apps); while ($app = each($s_apps)) { $sql = "DELETE FROM phpgw_acl WHERE acl_appname='".$app[1]."' AND acl_location='run' AND acl_account=" - . $account[1]["account_id"]." AND acl_account_type='u'"; + . $account[1]["account_id"]; $phpgw_setup->db->query($sql ,__LINE__,__FILE__); - $sql = "insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)" - . " values('".$app[1]."','run',".$account[1]["account_id"].",'u',1)"; + $sql = "insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)" + . " values('".$app[1]."','run',".$account[1]["account_id"].",1)"; $phpgw_setup->db->query($sql ,__LINE__,__FILE__); } $sql = "DELETE FROM phpgw_acl WHERE acl_appname='admin' AND acl_location='run' AND acl_account=" - . $account[1]["account_id"]." AND acl_account_type='u'"; - $phpgw_setup->db->query($sql ,__LINE__,__FILE__); - - $sql = "insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)" - . " values('admin','run',".$account[1]["account_id"].",'u',1)"; + . $account[1]["account_id"]; $phpgw_setup->db->query($sql ,__LINE__,__FILE__); + + for ($a=0;$adb->query($sql ,__LINE__,__FILE__); + } + } $phpgw_setup->db->query("SELECT account_id FROM phpgw_accounts WHERE account_id=" . $account[1]["account_id"] . " AND account_lid='" . $account[1]["account_lid"] . "'"); if(!$phpgw_setup->db->num_rows() && $account[1]["account_lid"]) { - $phpgw_setup->db->query("insert into phpgw_accounts (account_id,account_lid,account_pwd," - . "account_groups,account_status,account_lastpwd_change) values (" . $account[1]["account_id"] . ",'" - . $account[1]["account_lid"] . "','x',',1:0,','A',".time().")",__LINE__,__FILE__); + $phpgw_setup->db->query("insert into phpgw_accounts (account_id,account_lid,account_pwd,account_type," + . "account_status,account_lastpwd_change) values (" . $account[1]["account_id"] . ",'" + . $account[1]["account_lid"] . "','x','u','A',".time().")",__LINE__,__FILE__); } } $setup_complete = True;