modified the ldap class, to know the type of account(u or g)

This commit is contained in:
Lars Kneschke 2001-09-18 17:55:36 +00:00
parent 4c4fcee9cc
commit 3985fe231d
4 changed files with 23 additions and 12 deletions

View File

@ -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'])

View File

@ -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);
}

View File

@ -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];
}

View File

@ -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();