[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.accounts_ldap.inc.php, 1.101.2.13.
From: |
Alejandro Borges (lex) <address@hidden> |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.accounts_ldap.inc.php, 1.101.2.13.2.6, 1.101.2.13.2.7 class.contacts.inc.php, 1.12.4.1, 1.12.4.2 class.contacts_sql.inc.php, 1.17.2.2.2.33, 1.17.2.2.2.34 |
Date: |
Thu, 30 Oct 2003 02:47:55 +0000 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv20875/inc
Modified Files:
Tag: Version-0_9_16-branch
class.accounts_ldap.inc.php class.contacts.inc.php
class.contacts_sql.inc.php
Log Message:
accounts-LDAP and inetOrgPerson Syncronization is now TESTED WORKING - ALPHA
Index: class.contacts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.contacts.inc.php,v
retrieving revision 1.12.4.1
retrieving revision 1.12.4.2
diff -C2 -d -r1.12.4.1 -r1.12.4.2
*** class.contacts.inc.php 23 Sep 2003 01:55:39 -0000 1.12.4.1
--- class.contacts.inc.php 30 Oct 2003 02:47:53 -0000 1.12.4.2
***************
*** 1,9 ****
<?php
- if (!$GLOBALS['phpgw_info']['server']['contact_repository'])
- {
- $GLOBALS['phpgw_info']['server']['contact_repository'] = 'sql';
- }
print_debug('Contact
Repository:',"'".$GLOBALS['phpgw_info']['server']['contact_repository']."'",'api');
! include(PHPGW_API_INC .
'/class.contacts_'.$GLOBALS['phpgw_info']['server']['contact_repository'] .
'.inc.php');
include(PHPGW_API_INC . '/class.contacts_shared.inc.php');
?>
--- 1,5 ----
<?php
print_debug('Contact
Repository:',"'".$GLOBALS['phpgw_info']['server']['contact_repository']."'",'api');
! include(PHPGW_API_INC . '/class.contacts_sql.inc.php');
include(PHPGW_API_INC . '/class.contacts_shared.inc.php');
?>
Index: class.contacts_sql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.contacts_sql.inc.php,v
retrieving revision 1.17.2.2.2.33
retrieving revision 1.17.2.2.2.34
diff -C2 -d -r1.17.2.2.2.33 -r1.17.2.2.2.34
*** class.contacts_sql.inc.php 29 Oct 2003 05:09:48 -0000 1.17.2.2.2.33
--- class.contacts_sql.inc.php 30 Oct 2003 02:47:53 -0000 1.17.2.2.2.34
***************
*** 571,579 ****
}
! if
(!$GLOBALS['phpgw_info']['server']['contact_repository'] == 'ldap')
{
$this->LDAPSyncEnabled = true;
! $this->LDAPResource =
ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']);
!
ldap_bind($this->LDAPResource,$GLOBALS['phpgw_info']['server']['ldap_root_dn'],
$GLOBALS['phpgw_info']['server']['ldap_root_pw']);
}
}
--- 571,579 ----
}
! if
($GLOBALS['phpgw_info']['server']['contact_repository'] == 'ldap')
{
$this->LDAPSyncEnabled = true;
! $this->LDAPResource =
ldap_connect($GLOBALS['phpgw_info']['server']['ldap_contact_host']);
!
ldap_bind($this->LDAPResource,$GLOBALS['phpgw_info']['server']['ldap_contact_dn'],
$GLOBALS['phpgw_info']['server']['ldap_contact_pw']);
}
}
***************
*** 989,992 ****
--- 989,993 ----
'access',
'cat_id',
+ 'per_full_name',
'per_first_name',
'per_last_name',
***************
*** 1980,1983 ****
--- 1981,2001 ----
}
+ /**
+ * Allow to change the current owner for the new
+ * @param integer $old_owner Current owner
+ * @param integer $new_owner New owner, wath you want to have
now.
+ */
+ function change_owner_others($old_owner='',$new_owner='')
+ {
+ if (!($new_owner && $old_owner))
+ {
+ return False;
+ }
+ $contact = CreateObject('phpgwapi.contact_others');
+ return $contact->update(array('other_owner:' =>
$new_owner),
+
sql_criteria::_equal('other_owner',sql::integer($old_owner)),
+ PHPGW_SQL_RUN_SQL);
+ }
+
/*************************************************************\
* Add contact section *
***************
*** 2057,2060 ****
--- 2075,2082 ----
}
+ if($add_type == $this->_contact_person)
+ {
+ $this->finalize_add($cid);
+ }
return $cid;
}
***************
*** 2107,2111 ****
$execute =
$this->_add($principal,'person','person_id',$cid, $action);
$this->unlock_table();
! $this->finalize_add($cid);
return $execute;
}
--- 2129,2133 ----
$execute =
$this->_add($principal,'person','person_id',$cid, $action);
$this->unlock_table();
! //$this->finalize_add($cid);
return $execute;
}
***************
*** 3410,3414 ****
function LDAPSyncDelete($id)
{
! $result = ldap_search($this->LDAPResource,
$GLOBALS['phpgw_info']['server']['ldap_context'], 'contactID='.$id,
array('dn'));
$count = ldap_get_entries($this->LDAPResource, $result);
if ((int)$count['count'] > 0)
--- 3432,3436 ----
function LDAPSyncDelete($id)
{
! $result = ldap_search($this->LDAPResource,
$GLOBALS['phpgw_info']['server']['ldap_contact_context'], 'contactID='.$id,
array('dn'));
$count = ldap_get_entries($this->LDAPResource, $result);
if ((int)$count['count'] > 0)
***************
*** 3421,3517 ****
{
$this->LDAPSyncDelete($id);
-
- $person = $this->get_persons(array('person_id',
- 'per_first_name',
- 'per_last_name',
- //'fn', //'CONCAT(
IFNULL( CONCAT(first_name," "), ""),last_name)'
- 'per_initials',
- 'per_title',
- 'per_department',
- 'per_pubkey'
- ),
- '','','','','',
- array('contact_id', $id,
'equal')
- );
-
- $attributes = array();
- $attributes['objectclass'][] = 'inetorgperson';
- $attributes['objectclass'][] = 'phpgwcontact';
! $attributes['sn'][] =
utf8_encode($person[0]['per_last_name']);
! $attributes['contactID'][] =
utf8_encode($person[0]['person_id']);
!
! $attributes['cn'][] =
utf8_encode($person[0]['per_last_name']);
! //$attributes['displayname'][] =
utf8_encode($person[0]['fn']);
! $dn =
'cn='.$attributes['sn'][0].':'.time().','.$GLOBALS['phpgw_info']['server']['ldap_context'];
!
! if ($person[0]['per_first_name'])
{
! $attributes['givenname'][] =
utf8_encode($person[0]['per_first_name']);
}
!
! if ($person[0]['per_initials'])
{
! $attributes['initials'][] =
utf8_encode($person[0]['per_initials']);
}
!
! if ($person[0]['per_title'])
{
! $attributes['title'][] =
utf8_encode($person[0]['per_title']);
}
!
! if ($person[0]['per_department'])
{
! $attributes['ou'][] =
utf8_encode($person[0]['per_department']);
}
!
! if ($person[0]['per_pubkey'])
{
! $attributes['userPKCS12'][] =
utf8_encode($person[0]['per_pubkey']);
}
!
! $address = $this->get_addr_contact_data($id,
array('addr_pref_val'=>'Y'));
!
! for ($i = 0; $i < count ($address); $i++)
{
! if ($address[$i]['addr_contact_id'] == $id &&
$address[$i]['addr_preferred'] == 'Y')
! {
! if ($address[$i]['addr_add1'])
! {
! $attributes['postaladdress'][]
= utf8_encode($address[$i]['addr_add1']);
! }
!
! if ($address[$i]['addr_add2'])
! {
! $attributes['postaladdress'][]
= utf8_encode($address[$i]['addr_add2']);
! }
!
! if ($address[$i]['addr_city'])
! {
! $attributes['l'][] =
utf8_encode($address[$i]['addr_city']);
! }
! if ($address[$i]['addr_state'])
! {
! $attributes['st'][] =
utf8_encode($address[$i]['addr_state']);
! }
! if ($address[$i]['addr_postal_code'])
! {
! $attributes['postalcode'][] =
utf8_encode($address[$i]['addr_postal_code']);
! }
! if ($address[$i]['addr_country'])
! {
! $attributes['c'][] =
utf8_encode($address[$i]['addr_country']);
! if (!in_array('country',
$attributes['objectclass']))
! {
!
$attributes['objectclass'][] = 'country';
! }
! }
! }
}
$db2LDAP_map['home email'] = 'mail';
$db2LDAP_map['work email'] = 'mail';
--- 3443,3520 ----
{
$this->LDAPSyncDelete($id);
! $person = $this->get_principal_persons_data($id);
! $time = gettimeofday();
! $uid =
time().$time['usec'].':'.$person[0]['per_full_name'];
! $dn = 'uid=' . $uid.',' .
$GLOBALS['phpgw_info']['server']['ldap_contact_context'];
!
! /* Requerid attributes */
! $attributes['objectClass'][] =
'person';
! $attributes['objectClass'][] =
'organizationalPerson';
! $attributes['objectClass'][] =
'inetOrgPerson';
! $attributes['cn'][] =
utf8_encode($person[0]['per_full_name']);
! $attributes['sn'][] =
utf8_encode($person[0]['per_full_name']);
! /* Optional attributes */
! $attributes['uid'][] = $uid;
! if($person[0]['org_name'])
{
! $attributes['o'][]
= utf8_encode($person[0]['org_name']);
}
! if($person[0]['per_title'])
{
! $attributes['title'][]
= utf8_encode($person[0]['per_title']);
}
! if($person[0]['per_first_name'])
{
! $attributes['displayName'][]
= utf8_encode($person[0]['per_first_name']);
}
! if($person[0]['per_last_name'])
{
! $attributes['givenName'][]
= utf8_encode($person[0]['per_last_name']);
}
! if($person[0]['per_initials'])
{
! $attributes['initials'][]
= utf8_encode($person[0]['per_initials']);
}
! if($person[0]['per_department'])
{
! $attributes['ou'][]
= utf8_encode($person[0]['per_department']);
! }
! if($person[0]['contact_id'])
! {
! $attributes['employeeNumber'][]
= utf8_encode($person[0]['contact_id']);
! }
! unset($person);
! $address_pref = $this->get_addr_contact_data($id,
array('addr_pref_val'=>'Y'));
! if($address_pref[0]['addr_add1'] ||
$address_pref[0]['addr_add2'] || $address_pref[0]['addr_add3'])
! {
! $attributes['street'][]
= utf8_encode($address_pref[0]['addr_add1'] .
!
$address_pref[0]['addr_add2'] .
!
$address_pref[0]['addr_add3']);
! $attributes['postalAddress'][]
= utf8_encode($address_pref[0]['addr_add1'] .
!
$address_pref[0]['addr_add2'] .
!
$address_pref[0]['addr_add3']);
}
+ if($address_pref[0]['addr_state'])
+ {
+ $attributes['st'][]
= utf8_encode($address_pref[0]['addr_state']);
+ }
+ if($address_pref[0]['addr_postal_code'])
+ {
+ $attributes['postalCode'][]
= utf8_encode($address_pref[0]['addr_postal_code']);
+ }
+ if($address_pref[0]['addr_city'])
+ {
+ $attributes['l'][]
= utf8_encode($address_pref[0]['addr_city']);
+ }
+ //$attributes['homePostalAddress'][] = '';
//we can use the address with type home
+
+ unset($address_pref);
+
$db2LDAP_map['home email'] = 'mail';
$db2LDAP_map['work email'] = 'mail';
***************
*** 3526,3530 ****
$db2LDAP_map['website'] = 'labeledURI';
-
$comms = $this->get_comm_contact_data($id, '');
for ($i=0; $i < count($comms); $i++)
--- 3529,3532 ----
***************
*** 3542,3578 ****
}
}
! }
!
! $orgs = $this->get_organizations_by_person($id);
!
! /* Workaround */
! for ($i=0; $i < count($orgs); $i++)
! {
! $orgName = $this->get_orgs(array('org_name'),
'', '', '', '', '', sql_criteria::_equal('org_id', $orgs[$i]['my_org_id']));
! $orgName = $orgName[0]['org_name'];
! $orgs[$i]['org_name'] = $orgName;
! }
! /* Workaround End */
- for ($i=0; $i < count($orgs); $i++)
- {
- if ($orgs[$i]['org_name'])
- {
- if ($orgs[$i]['my_preferred'] == 'Y' &&
count($attributes['o']) > 0)
- {
- array_unshift($attributes['o'],
utf8_encode($orgs[$i]['org_name']));
- }
- else
- {
- $attributes['o'][] =
utf8_encode($orgs[$i]['org_name']);
- }
- }
- }
-
- //echo "<pre>";
- //print_r($attributes);
- //echo "</pre>";
-
ldap_add($this->LDAPResource, $dn, $attributes);
//ldap_close($this->LDAPResource);
//die('debug');
--- 3544,3552 ----
}
}
! }
ldap_add($this->LDAPResource, $dn, $attributes);
+ //echo ldap_error($this->LDAPResource);
+
//ldap_close($this->LDAPResource);
//die('debug');
Index: class.accounts_ldap.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.accounts_ldap.inc.php,v
retrieving revision 1.101.2.13.2.6
retrieving revision 1.101.2.13.2.7
diff -C2 -d -r1.101.2.13.2.6 -r1.101.2.13.2.7
*** class.accounts_ldap.inc.php 28 Oct 2003 06:46:18 -0000 1.101.2.13.2.6
--- class.accounts_ldap.inc.php 30 Oct 2003 02:47:53 -0000 1.101.2.13.2.7
***************
*** 763,767 ****
}
else
! {
$dn = 'uid=' .
$account_info['account_lid'] . ',' . $this->user_context;
$entry['cn'] = sprintf("%s %s",
$account_info['account_firstname'], $account_info['account_lastname']);
--- 763,767 ----
}
else
! {
$dn = 'uid=' .
$account_info['account_lid'] . ',' . $this->user_context;
$entry['cn'] = sprintf("%s %s",
$account_info['account_firstname'], $account_info['account_lastname']);
***************
*** 789,796 ****
$entry['phpgwaccounttype'] =
$account_info['account_type'];
$entry['phpgwaccountexpires'] =
$account_info['account_expires'];
}
! /* _debug_array($entry);exit; */
!
ldap_add($this->ds, $dn, $entry);
}
--- 789,796 ----
$entry['phpgwaccounttype'] =
$account_info['account_type'];
$entry['phpgwaccountexpires'] =
$account_info['account_expires'];
+ $entry['phpgwpersonid'] =
$account_info['person_id'];
}
! /* _debug_array($entry);exit; */
ldap_add($this->ds, $dn, $entry);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc class.accounts_ldap.inc.php, 1.101.2.13.2.6, 1.101.2.13.2.7 class.contacts.inc.php, 1.12.4.1, 1.12.4.2 class.contacts_sql.inc.php, 1.17.2.2.2.33, 1.17.2.2.2.34,
Alejandro Borges (lex) <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] admin/templates/default account_form_ldap.tpl, 1.15.4.3, 1.15.4.4 account_form.tpl, 1.22.4.5, 1.22.4.6
- Next by Date:
[Phpgroupware-cvs] phpgwapi/doc/ldap README, 1.13.4.1, 1.13.4.2 phpgw.at.conf, 1.2, 1.2.4.1 phpgw.oc.conf, 1.3, 1.3.4.1 phpgwaccount.schema, 1.6, 1.6.4.1 phpgwcontact.schema, 1.11, 1.11.4.1
- Previous by thread:
[Phpgroupware-cvs] admin/templates/default account_form_ldap.tpl, 1.15.4.3, 1.15.4.4 account_form.tpl, 1.22.4.5, 1.22.4.6
- Next by thread:
[Phpgroupware-cvs] phpgwapi/doc/ldap README, 1.13.4.1, 1.13.4.2 phpgw.at.conf, 1.2, 1.2.4.1 phpgw.oc.conf, 1.3, 1.3.4.1 phpgwaccount.schema, 1.6, 1.6.4.1 phpgwcontact.schema, 1.11, 1.11.4.1
- Index(es):