[geeklog-cvs] Auth_Enterprise/Client AEXMLRPC.class.php,1.2,1.3

tony at geeklog.net tony at geeklog.net
Tue Oct 28 23:15:12 EST 2003


Update of /usr/cvs/geeklog/Auth_Enterprise/Client
In directory geeklog_prod:/tmp/cvs-serv9229

Modified Files:
	AEXMLRPC.class.php 
Log Message:
Now uses XML_RPC_decode to get the user object.  I also added a function to convert an array group structure to the a correspondign set of group objects.

Index: AEXMLRPC.class.php
===================================================================
RCS file: /usr/cvs/geeklog/Auth_Enterprise/Client/AEXMLRPC.class.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AEXMLRPC.class.php	29 Oct 2003 00:52:40 -0000	1.2
--- AEXMLRPC.class.php	29 Oct 2003 04:15:10 -0000	1.3
***************
*** 62,78 ****
      *
      */
!     function &authenticate($userId, $password)
      {
          $xmlRequest = new XML_RPC_Message('Auth_Enterprise.processRequest', array(new XML_RPC_Value('authenticate','string'),
                                                                                    new XML_RPC_Value($this->getAppId(), 'string'),
!                                                                                   new XML_RPC_Value($userId, 'string'),
                                                                                    new XML_RPC_Value($password, 'string')));
          AEUtility::logMessage('Calling service from XMLRPC client provider',__FILE__,__LINE__);
          AEUtility::logObject($xmlRequest,__FILE__,__LINE__);
          $response = $this->_XMLRPCClient->send($xmlRequest);
-         print_r($response);
-         print "\n<br>HERE:<br>\n";
          $retval = $response->value();
          print_r($retval);
          /*if (!$response->faultCode()) {
              
--- 62,82 ----
      *
      */
!     function &authenticate($userName, $password)
      {
          $xmlRequest = new XML_RPC_Message('Auth_Enterprise.processRequest', array(new XML_RPC_Value('authenticate','string'),
                                                                                    new XML_RPC_Value($this->getAppId(), 'string'),
!                                                                                   new XML_RPC_Value($userName, 'string'),
                                                                                    new XML_RPC_Value($password, 'string')));
          AEUtility::logMessage('Calling service from XMLRPC client provider',__FILE__,__LINE__);
          AEUtility::logObject($xmlRequest,__FILE__,__LINE__);
          $response = $this->_XMLRPCClient->send($xmlRequest);
          $retval = $response->value();
+         $retval = XML_RPC_decode($retval);
          print_r($retval);
+         $user = new AEUser();
+         $user->setUserId($retval[_userId]);
+         $user->setUserName($retval[_userName]);
+         $user->setGroups($this->_moveGroupsToObjects($retval[_groups]));
+         print_r($user);
          /*if (!$response->faultCode()) {
              
***************
*** 155,158 ****
--- 159,186 ----
      function listAppPrivileges()
      {
+     }
+     
+     /**
+     * Copies the group arrays returned from the XML_RPC call
+     * into Group objects
+     *
+     * @author Tony Bibbs <tony at geeklog.net>
+     * @access private
+     * @param array $groupArray Array of group arrays
+     * @return array Array of AEGroup objects
+     *
+     */
+     function _moveGroupsToObjects($groups)
+     {
+         $groupArray = array();
+         $tmpGroup = new AEGroup();
+         foreach ($groups as $curGroup) {
+             $tmpGroup->setGroupId($curGroup[_groupId]);
+             $tmpGroup->setGroupLogicalName($curGroup[_groupLogicalName]);
+             $tmpGroup->setGroupDisplayName($curGroup[_groupDisplayName]);
+             $tmpGroup->setGroupDesc($curGroup[_groupDesc]);
+             $groupArray[] = $tmpGroup;
+         }
+         return $groupArray;
      }
  }





More information about the geeklog-cvs mailing list