[geeklog-cvs] Auth_Enterprise/Client AEXMLRPCClient.class.php,1.7,1.8
tony at iowaoutdoors.org
tony at iowaoutdoors.org
Sat Jul 3 14:05:55 EDT 2004
Update of /var/cvs/Auth_Enterprise/Client
In directory www:/tmp/cvs-serv32106
Modified Files:
AEXMLRPCClient.class.php
Log Message:
Tons of changes to get all of the XMLRPC support working.
Index: AEXMLRPCClient.class.php
===================================================================
RCS file: /var/cvs/Auth_Enterprise/Client/AEXMLRPCClient.class.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** AEXMLRPCClient.class.php 1 Jul 2004 18:42:43 -0000 1.7
--- AEXMLRPCClient.class.php 3 Jul 2004 18:05:52 -0000 1.8
***************
*** 156,179 ****
$user->setUserName($retval['userName']);
$user->setPassword($retval['password']);
! $privArray = array();
! foreach ($retval['privileges'] as $curPriv) {
! $tmpPriv = new AEPrivilege();
! $tmpPriv->setPrivilegeCode($curPriv['privilegeCode']);
! $tmpPriv->setPrivilegeCode($curPriv['privilegeDesc']);
! $privArray[] = $tmpPriv;
! }
! $user->setPrivileges($privArray);
!
! $groupArray[] = array();
! foreach ($retval['groups'] as $curGroup) {
! $tmpGroup = new AEGroup();
! $tmpGroup->setGroupId($curGroup['groupId']);
! $tmpGroup->setGroupLogicalName($curGroup['groupLogicalName']);
! $tmpGroup->setGroupDisplayName($curGroup['groupDisplayName']);
! $tmpGroup->setGroupDesc($curGroup['groupDesc']);
! $groupArray[] = $tmpGroup;
! }
! $user->setGroups($groupArray);
!
return $user;
--- 156,161 ----
$user->setUserName($retval['userName']);
$user->setPassword($retval['password']);
! //$user->setPrivileges($this->arrayToPrivileges($retval['privileges']));
! //$user->setGroups($this->arrayToGroups($retval['groups']));
return $user;
***************
*** 299,302 ****
--- 281,288 ----
$retval = $response->value();
$retval = XML_RPC_decode($retval);
+
+ $retval = $this->arrayToPrivileges($retval);
+
+ return $retval;
}
***************
*** 316,320 ****
, new XML_RPC_Value($adminPassword, 'string')
, new XML_RPC_Value($userName, 'string')
! , new XML_RPC_Value($privArray, 'array')));
$response = $this->XMLRPCClient->send($xmlRequest, 0, $this->options['server_method']);
// If we got a fault, throw an exception back to the calling
--- 302,306 ----
, new XML_RPC_Value($adminPassword, 'string')
, new XML_RPC_Value($userName, 'string')
! , XML_RPC_Encode($this->privilegesToArray($privArray))));
$response = $this->XMLRPCClient->send($xmlRequest, 0, $this->options['server_method']);
// If we got a fault, throw an exception back to the calling
***************
*** 347,350 ****
--- 333,338 ----
$retval = $response->value();
$retval = XML_RPC_decode($retval);
+ $retval = $this->arrayToPrivileges($retval);
+ return $retval;
}
***************
*** 368,375 ****
// application
if ($response->faultCode()) {
! throw $this->faultToException($response->faultCode(), $response->faultString());
}
$retval = $response->value();
$retval = XML_RPC_decode($retval);
}
--- 356,366 ----
// application
if ($response->faultCode()) {
! //throw $this->faultToException($response->faultCode(), $response->faultString());
}
$retval = $response->value();
$retval = XML_RPC_decode($retval);
+ $retval = $this->arrayToGroups($retval);
+
+ return $retval;
}
***************
*** 389,393 ****
, new XML_RPC_Value($adminPassword, 'string')
, new XML_RPC_Value($userName, 'string')
! , new XML_RPC_Value($groupArray, 'array')));
$response = $this->XMLRPCClient->send($xmlRequest, 0, $this->options['server_method']);
// If we got a fault, throw an exception back to the calling
--- 380,384 ----
, new XML_RPC_Value($adminPassword, 'string')
, new XML_RPC_Value($userName, 'string')
! , XML_RPC_Encode($this->groupsToArray($groupArray))));
$response = $this->XMLRPCClient->send($xmlRequest, 0, $this->options['server_method']);
// If we got a fault, throw an exception back to the calling
***************
*** 423,426 ****
--- 414,508 ----
/**
+ * Converts an array from an XMLRPC response to an array of privileges objects
+ *
+ * @author Tony Bibbs <tony at geeklog.net>
+ * @access private
+ * @param array $privArray Array representing privilege objects
+ * @return array Array of actual AEPrivileges objects
+ *
+ */
+ private function arrayToPrivileges($privArray)
+ {
+ $retval = array();
+ if (is_array($privArray)) {
+ foreach ($privArray as $curPriv) {
+ $newPriv = new AEPrivilege();
+ $newPriv->setPrivilegeCode($curPriv['privilegeCode']);
+ $newPriv->setPrivilegeDesc($curPriv['privilegeDesc']);
+ $retval[] = $newPriv;
+ }
+ }
+ return $retval;
+ }
+
+ /**
+ * Converts AEPrivilege objects to arrays.
+ *
+ * @author Tony Bibbs <tony at geeklog.net>
+ * @access private
+ * @param array $privArray Array of AEPrivilege objects
+ * @return array Array representing AEPrivielge objects
+ *
+ */
+ private function privilegesToArray($privArray)
+ {
+ $retval = array();
+ foreach ($privArray as $curPriv) {
+ $tmpArray['privilegeCode'] = $curPriv->getPrivilegeCode();
+ $tmpArray['privilegeDesc'] = $curPriv->getPrivilegeDesc();
+ $retval[] = $tmpArray;
+ }
+ return $retval;
+ }
+
+ /**
+ * Converts an array from an XMLRPC response to an array of group objects
+ *
+ * @author Tony Bibbs <tony at geeklog.net>
+ * @access private
+ * @param array $groupArray Array representing group objects
+ * @return array Array of actual AEGroup objects
+ *
+ */
+ private function arrayToGroups($groupArray)
+ {
+ $retval = array();
+ if (is_array($groupArray)) {
+ foreach ($groupArray as $curGroup) {
+ $tmpGroup = new AEGroup();
+ $tmpGroup->setGroupId($curGroup['groupId']);
+ $tmpGroup->setGroupLogicalName($curGroup['groupLogicalName']);
+ $tmpGroup->setGroupDisplayName($curGroup['groupDisplayName']);
+ $tmpGroup->setGroupDesc($curGroup['groupDesc']);
+ $tmpGroup->setGroupPrivileges($curGroup['priviliges']);
+ $retval[] = $tmpGroup;
+ }
+ }
+ return $retval;
+ }
+
+ /**
+ * Converts AEPrivilege objects to arrays.
+ *
+ * @author Tony Bibbs <tony at geeklog.net>
+ * @access private
+ * @param array $privArray Array of AEPrivilege objects
+ * @return array Array representing AEPrivielge objects
+ *
+ */
+ private function groupsToArray($groupArray)
+ {
+ $retval = array();
+ foreach ($groupArray as $curGroup) {
+ $tmpArray['groupId'] = $curGroup->getGroupId();
+ $tmpArray['groupLogicalName'] = $curGroup->getGroupLogicalName();
+ $tmpArray['groupDisplayName'] = $curGroup->getGroupDisplayName();
+ $tmpArray['groupDesc'] = $curGroup->getGroupDesc();
+ $retval[] = $tmpArray;
+ }
+ return $retval;
+ }
+
+ /**
* Converts XML_RPC faults into exceptions
*
More information about the geeklog-cvs
mailing list