[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.31
From: |
nomail |
Subject: |
[Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.31 |
Date: |
Fri, 21 May 2004 21:17:10 -0000 |
Update of /sync/inc
Modified Files:
Branch:
class.bo_sync.inc.php
date: 2004/04/28 18:21:03; author: mkaemmerer; state: Exp; lines: +17 -19
Log Message:
- fixed switchuser to be more generic (PK+MK)
=====================================================================
Index: sync/inc/class.bo_sync.inc.php
diff -u sync/inc/class.bo_sync.inc.php:1.30 sync/inc/class.bo_sync.inc.php:1.31
--- sync/inc/class.bo_sync.inc.php:1.30 Wed Apr 28 13:42:11 2004
+++ sync/inc/class.bo_sync.inc.php Wed Apr 28 18:21:03 2004
@@ -97,11 +97,11 @@
if (($ret >= 0) and ($phpgw_accountid <>
$GLOBALS['phpgw_info']['user']['account_id']))
{
$sess = $this->SwitchUser($ret);
+
+ if ($this->debug)
+ error_log("AuthenticateSyncDevice: got new session: " . $sess);
}
- if ($this->debug)
- error_log("new session: " . $sess);
-
return array(
'result' => $ret,
'sessionid' => $GLOBALS['phpgw']->session->sessionid,
@@ -276,11 +276,10 @@
/**
* 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
- * @return string new sessionid
+ * @return string new sessionid or -1
*/
function SwitchUser($deviceid)
@@ -289,17 +288,16 @@
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);
-
- // e.g. $dn = $allValues[0]['dn'];
- // !!get $username and $password here
+ $account = CreateObject('phpgwapi.accounts', $AccountID, 'u');
+ $data = $account->read_repository();
+ $password = 'who the fsck care';
+ $username = $data['account_lid'];
if ($this->debug)
- error_log("SwitchUser LDAP: DeviceID: $deviceid, AccountID:
$AccountID, Username: $username");
- break;
+ error_log("SwitchUser LDAP (special): DeviceID: $deviceid,
AccountID: $AccountID, Username: $username");
+
+
$GLOBALS['phpgw']->session->destroy($GLOBALS['phpgw']->session->sessionid,$GLOBALS['phpgw']->session->kp3);
+ return $GLOBALS['phpgw']->session->create($username, '', 'none'); //
special version of class.sessions.inc.php needed
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__);
@@ -310,13 +308,13 @@
if ($this->debug)
error_log("SwitchUser SQL: DeviceID: $deviceid, AccountID:
$AccountID, Username: $username");
- break;
+
+
$GLOBALS['phpgw']->session->destroy($GLOBALS['phpgw']->session->sessionid,$GLOBALS['phpgw']->session->kp3);
+ return $GLOBALS['phpgw']->session->create($username, $password, 'md5');
default:
error_log("SwitchUser: Userswitching with method
".$GLOBALS['phpgw_info']['server']['auth_type']." is not supported");
+ return -1;
}
-
-
$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.31,
nomail <=