[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.29
From: |
nomail |
Subject: |
[Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.29 |
Date: |
Sun, 23 May 2004 02:34:40 -0000 |
Update of /sync/inc
Modified Files:
Branch:
class.bo_sync.inc.php
date: 2004/04/28 12:21:39; author: mkaemmerer; state: Exp; lines: +28 -8
Log Message:
- added temp for ldap user switching
=====================================================================
Index: sync/inc/class.bo_sync.inc.php
diff -u sync/inc/class.bo_sync.inc.php:1.28 sync/inc/class.bo_sync.inc.php:1.29
--- sync/inc/class.bo_sync.inc.php:1.28 Mon Apr 26 13:10:57 2004
+++ sync/inc/class.bo_sync.inc.php Wed Apr 28 12:21:39 2004
@@ -275,7 +275,8 @@
}
/**
- * switches the actual user (relogin as a new user)
+ * switches the actual user (relogin as a new user)
+ * currently supports only authenticating through LDAP and SQL
*
* @param integer $deviceid is the deviceid of the device which whant to
* do the sync
@@ -285,15 +286,34 @@
function SwitchUser($deviceid)
{
$AccountID = $this->so->GetAccountID($deviceid);
+
+ switch ($GLOBALS['phpgw_info']['server']['auth_type']) {
+ case "ldap":
+ // authenticate with LDAP
+ $ds = $GLOBALS['phpgw']->common->ldapConnect();
+ $sri = ldap_search($ds,
$GLOBALS['phpgw_info']['server']['ldap_context'], 'uidnumber='.$AccountID);
+ $allValues = ldap_get_entries($ds, $sri);
- $GLOBALS['phpgw']->db->query("SELECT account_lid, account_pwd FROM
phpgw_accounts WHERE account_id=$AccountID",__LINE__,__FILE__);
- $GLOBALS['phpgw']->db->next_record();
+ // e.g. $dn = $allValues[0]['dn'];
+ // !!get $username and $password here
+
+ if ($this->debug)
+ error_log("SwitchUser LDAP: DeviceID: $deviceid, AccountID:
$AccountID, Username: $username");
+ break;
+ case "sql":
+ // authenticate with own SQL database
+ $GLOBALS['phpgw']->db->query("SELECT account_lid, account_pwd FROM
phpgw_accounts WHERE account_id=$AccountID",__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->next_record();
- $username = $GLOBALS['phpgw']->db->f('account_lid');
- $password = $GLOBALS['phpgw']->db->f('account_pwd');
+ $username = $GLOBALS['phpgw']->db->f('account_lid');
+ $password = $GLOBALS['phpgw']->db->f('account_pwd');
- if ($this->debug)
- error_log("SwitchUser: DeviceID: $deviceid, AccountID: $AccountID,
Username: $username");
+ if ($this->debug)
+ error_log("SwitchUser SQL: DeviceID: $deviceid, AccountID:
$AccountID, Username: $username");
+ break;
+ default:
+ error_log("SwitchUser: Userswitching with method
".$GLOBALS['phpgw_info']['server']['auth_type']." is not supported");
+ }
$GLOBALS['phpgw']->session->destroy($GLOBALS['phpgw']->session->sessionid,$GLOBALS['phpgw']->session->kp3);
return $GLOBALS['phpgw']->session->create($username, $password, 'md5');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.29,
nomail <=