From 1cfeb896a7df0d17a5d88a5723cbad6f5a40ed96 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 23 Jun 2006 01:27:03 +0000 Subject: [PATCH] reversed password change ACL from changepassword to nopassword change, to allow eGW users created in LDAP to be full users, without the need to change/add something in the ACL table --- phpgwapi/setup/setup.inc.php | 2 +- phpgwapi/setup/tables_update.inc.php | 42 +++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/phpgwapi/setup/setup.inc.php b/phpgwapi/setup/setup.inc.php index 7742dc0b5e..479166962d 100755 --- a/phpgwapi/setup/setup.inc.php +++ b/phpgwapi/setup/setup.inc.php @@ -14,7 +14,7 @@ /* Basic information about this app */ $setup_info['phpgwapi']['name'] = 'phpgwapi'; $setup_info['phpgwapi']['title'] = 'eGroupWare API'; - $setup_info['phpgwapi']['version'] = '1.3.008'; + $setup_info['phpgwapi']['version'] = '1.3.009'; $setup_info['phpgwapi']['versions']['current_header'] = '1.28'; $setup_info['phpgwapi']['enable'] = 3; $setup_info['phpgwapi']['app_order'] = 1; diff --git a/phpgwapi/setup/tables_update.inc.php b/phpgwapi/setup/tables_update.inc.php index 123bca4319..baacdbfb53 100644 --- a/phpgwapi/setup/tables_update.inc.php +++ b/phpgwapi/setup/tables_update.inc.php @@ -514,4 +514,44 @@ return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.3.008'; } -?> + + $test[] = '1.3.008'; + function phpgwapi_upgrade1_3_008() + { + // reverse change-password ACL from 'changepassword' to 'nopasswordchange', + // to allow users created in LDAP to be automatic full eGW users + $acocunts = $change_passwd_acls = array(); + // get all accounts with acl settings + $GLOBALS['egw_setup']->db->select('egw_acl','DISTINCT acl_account','acl_account > 0',__LINE__,__FILE__); + while(($row = $GLOBALS['egw_setup']->db->row(true))) + { + $accounts[] = $row['acl_account']; + } + // get all accounts with change password acl (allowance to change the password) + $GLOBALS['egw_setup']->db->select('egw_acl','DISTINCT acl_account',array( + 'acl_appname' => 'preferences', + 'acl_location' => 'changepassword', + 'acl_rights' => 1, + 'acl_account > 0', + ),__LINE__,__FILE__); + while(($row = $GLOBALS['egw_setup']->db->row(true))) + { + $change_passwd_acls[] = $row['acl_account']; + } + $GLOBALS['egw_setup']->db->delete('egw_acl',array( + 'acl_appname' => 'preferences', + 'acl_location' => 'changepassword', + ),__LINE__,__FILE__); + + // set the acl now for everyone NOT allowed to change the password + foreach(array_diff($accounts,$change_passwd_acls) as $account_id) + { + $GLOBALS['egw_setup']->db->insert('egw_acl',array( + 'acl_appname' => 'preferences', + 'acl_location' => 'nopasswordchange', + 'acl_rights' => 1, + 'acl_account' => $account_id, + ),false,__LINE__,__FILE__); + } + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.3.009'; + }