From 3985fe231ddf1c3dbfb45a7f3b0e80dffcad41c0 Mon Sep 17 00:00:00 2001 From: Lars Kneschke Date: Tue, 18 Sep 2001 17:55:36 +0000 Subject: [PATCH] modified the ldap class, to know the type of account(u or g) --- admin/inc/class.boaccounts.inc.php | 14 +++++++------- admin/inc/class.uiaccounts.inc.php | 6 +++--- phpgwapi/inc/class.accounts_ldap.inc.php | 8 +++++++- phpgwapi/inc/class.accounts_shared.inc.php | 7 ++++++- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/admin/inc/class.boaccounts.inc.php b/admin/inc/class.boaccounts.inc.php index 8abacd7c66..34951ab8fe 100755 --- a/admin/inc/class.boaccounts.inc.php +++ b/admin/inc/class.boaccounts.inc.php @@ -184,7 +184,7 @@ ) ); - $group = CreateObject('phpgwapi.accounts',$group_info['account_id']); + $group = CreateObject('phpgwapi.accounts',$group_info['account_id'],'g'); $group->acct_type = 'g'; $account_info = array( 'account_type' => 'g', @@ -440,7 +440,7 @@ 'account_user' => $account_user, 'account_apps' => $account_apps ); - + $this->validate_group($group_info); // Lock tables @@ -457,9 +457,9 @@ ) ); - $group = CreateObject('phpgwapi.accounts',$group_info['account_id']); + $group = CreateObject('phpgwapi.accounts',$group_info['account_id'],'g'); $old_group_info = $group->read_repository(); - + // Set group apps $apps = CreateObject('phpgwapi.applications',$group_info['account_id']); $apps_before = $apps->read_account_specific(); @@ -634,7 +634,7 @@ { $errors = Array(); - $group = CreateObject('phpgwapi.accounts',$group_info['account_id']); + $group = CreateObject('phpgwapi.accounts',$group_info['account_id'],'g'); $group->read_repository(); if(!$group_info['account_name']) @@ -760,7 +760,7 @@ /* stores the userdata */ function save_user($_userData) { - $account = CreateObject('phpgwapi.accounts',$_userData['account_id']); + $account = CreateObject('phpgwapi.accounts',$_userData['account_id'],'u'); $account->update_data($_userData); $account->save_repository(); if ($_userData['account_passwd']) @@ -784,7 +784,7 @@ } $apps->save_repository(); - $account = CreateObject('phpgwapi.accounts',$_userData['account_id']); + $account = CreateObject('phpgwapi.accounts',$_userData['account_id'],'u'); $allGroups = $account->get_list('groups'); if ($_userData['account_groups']) diff --git a/admin/inc/class.uiaccounts.inc.php b/admin/inc/class.uiaccounts.inc.php index 155fa2eb99..2969ff5127 100755 --- a/admin/inc/class.uiaccounts.inc.php +++ b/admin/inc/class.uiaccounts.inc.php @@ -547,7 +547,7 @@ $t->parse('password_fields','form_logininfo',True); - $account = CreateObject('phpgwapi.accounts',intval($GLOBALS['HTTP_GET_VARS']['account_id'])); + $account = CreateObject('phpgwapi.accounts',intval($GLOBALS['HTTP_GET_VARS']['account_id']),'u'); $userData = $account->read_repository(); $var['account_lid'] = $userData['account_lid']; @@ -690,7 +690,7 @@ ) ); - $accounts = CreateObject('phpgwapi.accounts',$group_info['account_id']); + $accounts = CreateObject('phpgwapi.accounts',$group_info['account_id'],'u'); $account_list = $accounts->get_list('accounts'); $account_num = count($account_list); @@ -823,7 +823,7 @@ { if($_account_id) { - $account = CreateObject('phpgwapi.accounts',intval($_account_id)); + $account = CreateObject('phpgwapi.accounts',intval($_account_id),'u'); $userData = $account->read_repository(); $userGroups = $account->membership($_account_id); } diff --git a/phpgwapi/inc/class.accounts_ldap.inc.php b/phpgwapi/inc/class.accounts_ldap.inc.php index a347d9207d..b7d06a07b2 100644 --- a/phpgwapi/inc/class.accounts_ldap.inc.php +++ b/phpgwapi/inc/class.accounts_ldap.inc.php @@ -449,6 +449,11 @@ function get_type($accountid = '') { + if (isset($this->account_type)) + { + return $this->account_type; + } + static $account_type; $account_id = get_account_id($accountid); @@ -456,13 +461,14 @@ { return $account_type[$account_id]; } - + $allValues = array(); $sri = ldap_search($this->ds, $this->user_context, "(&(uidnumber=$account_id)(phpgwaccounttype=u))"); $allValues = ldap_get_entries($this->ds, $sri); if ($allValues[0]['phpgwaccounttype'][0]) { + $allValues[0]['phpgwaccounttype'][0]; $account_type[$account_id] = $allValues[0]['phpgwaccounttype'][0]; return $account_type[$account_id]; } diff --git a/phpgwapi/inc/class.accounts_shared.inc.php b/phpgwapi/inc/class.accounts_shared.inc.php index 492991e388..e4bbda91cf 100644 --- a/phpgwapi/inc/class.accounts_shared.inc.php +++ b/phpgwapi/inc/class.accounts_shared.inc.php @@ -75,7 +75,7 @@ * This constructor sets the account id, if string is sent, converts to id * * I might move this to the accounts_shared if it stays around * \**************************************************************************/ - function accounts($account_id = '') + function accounts($account_id = '', $account_type='') { $this->db = $GLOBALS['phpgw']->db; @@ -84,6 +84,11 @@ $this->account_id = get_account_id($account_id); } + if($account_type != '') + { + $this->account_type = $account_type; + } + if($GLOBALS['phpgw_info']['server']['account_repository'] == 'ldap') { $this->ds = $GLOBALS['phpgw']->common->ldapConnect();