[geeklog-cvs] A_and_A/client AAServiceInterface.class.php,1.10,1.11 AAUser.class.php,1.5,1.6

tony at geeklog.net tony at geeklog.net
Fri Jan 10 00:55:20 EST 2003


Update of /usr/cvs/geeklog/A_and_A/client
In directory internal.geeklog.net:/tmp/cvs-serv11761

Modified Files:
	AAServiceInterface.class.php AAUser.class.php 
Log Message:
Tons of fixes.  Mostly working again

Index: AAServiceInterface.class.php
===================================================================
RCS file: /usr/cvs/geeklog/A_and_A/client/AAServiceInterface.class.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** AAServiceInterface.class.php	28 Nov 2002 00:23:56 -0000	1.10
--- AAServiceInterface.class.php	10 Jan 2003 05:55:18 -0000	1.11
***************
*** 49,56 ****
      * 
      */
!     function &authenticate($aaServer, $appId, $userId, $password, $aaPort=80)
      {
          // Build and send XML request
!         $requestXML = AAServiceInterface::_buildAuthenticateRequest($appId, $userId, $password);
          $responseXML = AAServiceInterface::_request($aaServer,'POST','/entaa/',$requestXML,$aaPort);        
          $user = &AAServiceInterface::_handleAuthenticateResponse($responseXML, $aaServer, $aaPort);
--- 49,56 ----
      * 
      */
!     function &authenticate($aaServer, $appId, $userName, $password, $aaPort=80)
      {
          // Build and send XML request
!         $requestXML = AAServiceInterface::_buildAuthenticateRequest($appId, $userName, $password);
          $responseXML = AAServiceInterface::_request($aaServer,'POST','/entaa/',$requestXML,$aaPort);        
          $user = &AAServiceInterface::_handleAuthenticateResponse($responseXML, $aaServer, $aaPort);
***************
*** 65,69 ****
  
          $user->setAppId($appId);
!         $user->setUserId($userId);
          $user->setPassword($password);
  
--- 65,69 ----
  
          $user->setAppId($appId);
!         $user->setUserName($userName);
          $user->setPassword($password);
  
***************
*** 86,92 ****
      *
      */
!     function changePassword($aaServer, $appId, $userId, $password, $newPassword, $aaPort=80)
      {
!         $requestXML = AAServiceInterface::_buildChangePasswordRequest($appId, $userId, $password, $newPassword);
          $responseXML = AAServiceInterface::_request($aaServer,'POST','/entaa/',$requestXML,$aaPort);
          $error = AAServiceInterface::_handleResponse($responseXML);
--- 86,92 ----
      *
      */
!     function changePassword($aaServer, $appId, $userName, $password, $newPassword, $aaPort=80)
      {
!         $requestXML = AAServiceInterface::_buildChangePasswordRequest($appId, $userName, $password, $newPassword);
          $responseXML = AAServiceInterface::_request($aaServer,'POST','/entaa/',$requestXML,$aaPort);
          $error = AAServiceInterface::_handleResponse($responseXML);
***************
*** 112,118 ****
      *
      */
!     function changePasswordByAdmin($aaServer, $appId, $adminUserId, $adminPassword, $userId, $newPassword, $aaPort=80)
      {
!         $requestXML = AAServiceInterface::_buildChangePasswordByAdminRequest($appId, $adminUserId, $adminPassword, $userId, $newPassword);
          $responseXML = AAServiceInterface::_request($aaServer,'POST','/entaa/',$requestXML,$aaPort);
          $error = AAServiceInterface::_handleResponse($responseXML);
--- 112,118 ----
      *
      */
!     function changePasswordByAdmin($aaServer, $appId, $adminUserName, $adminPassword, $userName, $newPassword, $aaPort=80)
      {
!         $requestXML = AAServiceInterface::_buildChangePasswordByAdminRequest($appId, $adminUserName, $adminPassword, $userName, $newPassword);
          $responseXML = AAServiceInterface::_request($aaServer,'POST','/entaa/',$requestXML,$aaPort);
          $error = AAServiceInterface::_handleResponse($responseXML);
***************
*** 123,151 ****
      }
  
!     /**
!     * Resets a password
!     *
!     * This method allows an admin user to reset the password for the specified user.  
!     * Returns the new, randomly generated password
!     * 
!     * @param    string      $appId          Application to reset password for 
!     * @param    string      $adminUserId    Admin performing the reset
!     * @param    string      $adminPassword  Admin's password
!     * @param    string      $userId         User to reset password for
!     * @return   string      Radomly generated password
!     *
!     */
!     function resetPassword($aaServer, $appId, $adminUserId, $adminPassword, $userId, $aaPort=80)
      {
!         $requestXML = AAServiceInterface::_buildResetPasswordRequest($appId, $adminUserId, $adminPassword, $userId);
!         $responseXML = AAServiceInterface::_request($aaServer, 'POST', '/entaaa/', $requestXML, $aaPort);
!         
!         $error = AAServiceInterface::_handleResponse($responseXML);
!         if ($error) {
              return false;
          }
!         return true;
      }
! 
      /**
      * Gets application priveliges for specified user
--- 123,137 ----
      }
  
!     function resetPassword($aaServer, $appId, $adminUserName, $adminPassword, $userName, $aaPort=80)
      {
!         $requestXML = AAServiceInterface::_buildResetPasswordRequest($appId, $adminUserName, $adminPassword, $userName);
!         $responseXML = AAServiceInterface::_request($aaServer, 'POST', '/entaa/', $requestXML, $aaPort);
!         $newPassword = AAServiceInterface::_handleResetPasswordResponse($responseXML);
!         if (get_class($newPassword) == 'aaexception') {
              return false;
          }
!         return $newPassword;
      }
!     
      /**
      * Gets application priveliges for specified user
***************
*** 224,228 ****
          return $groupArray;
      }
! 
      // Private Methods
  
--- 210,214 ----
          return $groupArray;
      }
!     
      // Private Methods
  
***************
*** 336,344 ****
      {
          $tree  = new XML_Tree;
!         $root = &$tree->addRoot('AAService');
          $authNode = &$root->addChild('Authenticate');
!         $appIDNode = &$authNode->addChild('AppId','',array('value'=>"$appId"));
!         $userIDNode = &$authNode->addChild('UserId','',array('value'=>"$userId"));
!         $passwordNode = &$authNode->addChild('Password','',array('value'=>"$password"));
          
          return $tree->get();
--- 322,330 ----
      {
          $tree  = new XML_Tree;
!         $root = &$tree->addRoot(AA_SERVICE_TAG);
          $authNode = &$root->addChild('Authenticate');
!         $appIDNode = &$authNode->addChild(APPLICATION_ID_TAG,'',array('value'=>"$appId"));
!         $userIDNode = &$authNode->addChild(USER_NAME_TAG,'',array('value'=>"$userId"));
!         $passwordNode = &$authNode->addChild(PASSWORD_TAG,'',array('value'=>"$password"));
          
          return $tree->get();
***************
*** 422,426 ****
          $changePasswordNode = &$root->addChild('ChangePassword');
          $tmpNode = &$changePasswordNode->addChild(APPLICATION_ID_TAG, '', array('value'=>$appId));
!         $tmpNode = &$changePasswordNode->addChild(USER_ID_TAG, '', array('value'=>$userId));
          $tmpNode = &$changePasswordNode->addChild(OLD_PASSWORD_TAG, '', array('value'=>"$oldPassword"));
          $tmpNode = &$changePasswordNode->addChild(NEW_PASSWORD_TAG, '', array('value'=>"$newPassword"));
--- 408,412 ----
          $changePasswordNode = &$root->addChild('ChangePassword');
          $tmpNode = &$changePasswordNode->addChild(APPLICATION_ID_TAG, '', array('value'=>$appId));
!         $tmpNode = &$changePasswordNode->addChild(USER_NAME_TAG, '', array('value'=>$userId));
          $tmpNode = &$changePasswordNode->addChild(OLD_PASSWORD_TAG, '', array('value'=>"$oldPassword"));
          $tmpNode = &$changePasswordNode->addChild(NEW_PASSWORD_TAG, '', array('value'=>"$newPassword"));
***************
*** 447,453 ****
          $changePassNode = &$root->addChild('ChangePasswordByAdmin');
          $tmpNode = &$changePassNode->addChild(APPLICATION_ID_TAG, '', array('value'=>"$appId"));
!         $tmpNode = &$changePassNode->addChild(ADMIN_USER_ID_TAG, '', array('value'=>"$adminUserId"));
          $tmpNode = &$changePassNode->addChild(ADMIN_PASSWORD_TAG, '', array('value'=>"$adminPassword"));
!         $tmpNode = &$changePassNode->addChild(USER_ID_TAG, '', array('value'=>"$userId"));
          $tmpNode = &$changePassNode->addChild(NEW_PASSWORD_TAG, '', array('value'=>"$newPassword"));
  
--- 433,439 ----
          $changePassNode = &$root->addChild('ChangePasswordByAdmin');
          $tmpNode = &$changePassNode->addChild(APPLICATION_ID_TAG, '', array('value'=>"$appId"));
!         $tmpNode = &$changePassNode->addChild(ADMIN_USER_NAME_TAG, '', array('value'=>"$adminUserId"));
          $tmpNode = &$changePassNode->addChild(ADMIN_PASSWORD_TAG, '', array('value'=>"$adminPassword"));
!         $tmpNode = &$changePassNode->addChild(USER_NAME_TAG, '', array('value'=>"$userId"));
          $tmpNode = &$changePassNode->addChild(NEW_PASSWORD_TAG, '', array('value'=>"$newPassword"));
  
***************
*** 479,489 ****
      * @access private
      * @param    string      $appId          Application ID
!     * @param    string      $adminUserId    Admin's user ID
      * @param    string      $adminPassword  Admin's password
!     * @param    string      $userId         ID of user to reset password for
      * return    string      XML request
      *
      */
!     function _buildResetPasswordRequest($appId, $adminUserId, $adminPassword, $userId)
      {   
          $tree = new XML_Tree;
--- 465,475 ----
      * @access private
      * @param    string      $appId          Application ID
!     * @param    string      $adminUserName    Admin's username
      * @param    string      $adminPassword  Admin's password
!     * @param    string      $userName         username of user to reset password for
      * return    string      XML request
      *
      */
!     function _buildResetPasswordRequest($appId, $adminUserName, $adminPassword, $userName)
      {   
          $tree = new XML_Tree;
***************
*** 491,505 ****
          $resetPassNode = &$root->addChild('ResetPassword');
          $tmpNode = &$resetPassNode->addChild(APPLICATION_ID_TAG, '', array('value'=>"$appId"));
!         $tmpNode = &$resetPassNode->addChild(ADMIN_USER_ID_TAG, '', array('value'=>"$adminUserId"));
          $tmpNode = &$resetPassNode->addChild(ADMIN_PASSWORD_TAG, '', array('value'=>"$adminPassword"));
!         $tmpNode = &$resetPassNode->addChild(USER_ID_TAG, '', array('value'=>"$userId"));
  
          return $tree->get();
      }
  
      function _handleResetPasswordResponse($responseXML)
      {
      }
- 
      /**
      * Builds an XML request for A&A Service to call getUserPrivilges on server
--- 477,500 ----
          $resetPassNode = &$root->addChild('ResetPassword');
          $tmpNode = &$resetPassNode->addChild(APPLICATION_ID_TAG, '', array('value'=>"$appId"));
!         $tmpNode = &$resetPassNode->addChild(ADMIN_USER_NAME_TAG, '', array('value'=>"$adminUserName"));
          $tmpNode = &$resetPassNode->addChild(ADMIN_PASSWORD_TAG, '', array('value'=>"$adminPassword"));
!         $tmpNode = &$resetPassNode->addChild(USER_NAME_TAG, '', array('value'=>"$userName"));
  
          return $tree->get();
      }
  
+ 
      function _handleResetPasswordResponse($responseXML)
      {
+         $p = xml_parser_create();
+         xml_parse_into_struct($p,$responseXML,$vals,$index) or die(xml_error_string(xml_get_error_code($p)));
+         xml_parser_free($p);    
+         $error = AAServiceInterface::_exceptionCheck($index, $vals);
+         if ($error) {
+             return $error;
+         }
+         
+         return $vals[$index['NEWPASSWORD'][0]];
      }
      /**
      * Builds an XML request for A&A Service to call getUserPrivilges on server
***************
*** 513,525 ****
      *
      */
!     function _buildGetUserPrivilegesRequest($appId, $adminUserId, $adminPassword, $userId)
      {
          $tree = new XML_Tree;
!         $root = &$tree->addRoot('AAService');
          $getUserPrivilegesNode = &$root->addChild('GetUserPrivileges');
!         $tmpNode = &$getUserPrivilegesNode->addChild('AppId', '', array('value'=>"$appId"));
!         $tmpNode = &$getUserPrivilegesNode->addChild('AdminUserId', '', array('value'=>"$adminUserId"));
!         $tmpNode = &$getUserPrivilegesNode->addChild('AdminPassword', '', array('value'=>"$adminPassword"));
!         $tmpNode = &$getUserPrivilegesNode->addChild('UserId', '', array('value'=>"$userId"));
  
          return $tree->get();
--- 508,520 ----
      *
      */
!     function _buildGetUserPrivilegesRequest($appId, $adminUserName, $adminPassword, $userName)
      {
          $tree = new XML_Tree;
!         $root = &$tree->addRoot(AA_SERVICE_TAG);
          $getUserPrivilegesNode = &$root->addChild('GetUserPrivileges');
!         $tmpNode = &$getUserPrivilegesNode->addChild(APPLICATION_ID_TAG, '', array('value'=>"$appId"));
!         $tmpNode = &$getUserPrivilegesNode->addChild(ADMIN_USER_NAME_TAG, '', array('value'=>"$adminUserName"));
!         $tmpNode = &$getUserPrivilegesNode->addChild(ADMIN_PASSWORD_TAG, '', array('value'=>"$adminPassword"));
!         $tmpNode = &$getUserPrivilegesNode->addChild(USER_NAME_TAG, '', array('value'=>"$userName"));
  
          return $tree->get();
***************
*** 563,575 ****
      {
          $tree = new XML_Tree;
!         $root = &$tree->addRoot('AAService');
          $setUserPrivilegesNode = &$root->addChild('SetUserPrivileges');
!         $tmpNode = &$setUserPrivilegesNode->addChild('AppId', '', array('value'=>$appId));
!         $tmpNode = &$setUserPrivilegesNode->addChild('AdminUserId', '', array('value'=>$adminUserId));
!         $tmpNode = &$setUserPrivilegesNode->addChild('AdminPassword', '', array('value'=>$adminPassword));
!         $tmpNode = &$setUserPrivilegesNode->addChild('UserId', '', array('value'=>$userId));
!         $privilegeListNode = &$setUserPrivilegesNode->addChild('PrivilegeList');
          foreach ($privileges as $curPriv) {
!             $tmpNode = &$privilegeListNode->addChild('Privilege', $curPriv->getPrivilegeDesc(), array('value'=>$curPriv->getPrivilegeCode()));
          }
          
--- 558,570 ----
      {
          $tree = new XML_Tree;
!         $root = &$tree->addRoot(AA_SERVICE_TAG);
          $setUserPrivilegesNode = &$root->addChild('SetUserPrivileges');
!         $tmpNode = &$setUserPrivilegesNode->addChild(APPLICATION_ID_TAG, '', array('value'=>$appId));
!         $tmpNode = &$setUserPrivilegesNode->addChild(ADMIN_USER_ID_TAG, '', array('value'=>$adminUserId));
!         $tmpNode = &$setUserPrivilegesNode->addChild(ADMIN_PASSWORD_TAG, '', array('value'=>$adminPassword));
!         $tmpNode = &$setUserPrivilegesNode->addChild(USER_ID_TAG, '', array('value'=>$userId));
!         $privilegeListNode = &$setUserPrivilegesNode->addChild(PRIVILEGE_LIST_TAG);
          foreach ($privileges as $curPriv) {
!             $tmpNode = &$privilegeListNode->addChild(PRIVILEGE_TAG, $curPriv->getPrivilegeDesc(), array('value'=>$curPriv->getPrivilegeCode()));
          }
          
***************
*** 591,602 ****
      *
      */
!     function _buildListAppPrivilegesRequest($appId, $adminUserId, $adminPassword)
      {
          $tree = new XML_Tree;
!         $root = &$tree->addRoot('AAService');
          $listAppPrivilegesNode = &$root->addChild('ListAppPrivileges');
!         $tmpNode = &$listAppPrivilegesNode->addChild('AppId', '', array('value'=>"$appId"));
!         $tmpNode = &$listAppPrivilegesNode->addChild('AdminUserId', '', array('value'=>"$adminUserId"));
!         $tmpNode = &$listAppPrivilegesNode->addChild('AdminPassword', '', array('value'=>"$adminPassword"));
  
          return $tree->get();
--- 586,597 ----
      *
      */
!     function _buildListAppPrivilegesRequest($appId, $adminUserName, $adminPassword)
      {
          $tree = new XML_Tree;
!         $root = &$tree->addRoot(AA_SERVICE_TAG);
          $listAppPrivilegesNode = &$root->addChild('ListAppPrivileges');
!         $tmpNode = &$listAppPrivilegesNode->addChild(APPLICATION_ID_TAG, '', array('value'=>"$appId"));
!         $tmpNode = &$listAppPrivilegesNode->addChild(ADMIN_USER_NAME_TAG, '', array('value'=>"$adminUserName"));
!         $tmpNode = &$listAppPrivilegesNode->addChild(ADMIN_PASSWORD_TAG, '', array('value'=>"$adminPassword"));
  
          return $tree->get();
***************
*** 635,646 ****
      *
      */
!     function _buildListAppGroupsRequest($appId, $adminUserId, $adminPassword)
      {
          $tree = new XML_Tree;
!         $root = &$tree->addRoot('AAService');
          $listAppGroupNode = &$root->addChild('ListAppGroups');
!         $tmpNode = &$listAppGroupNode->addChild('AppId', '', array('value'=>"$appId"));
!         $tmpNode = &$listAppGroupNode->addChild('AdminUserId', '', array('value'=>"$adminUserId"));
!         $tmpNode = &$listAppGroupNode->addChild('AdminPassword', '', array('value'=>"$adminPassword"));
  
          return $tree->get();
--- 630,641 ----
      *
      */
!     function _buildListAppGroupsRequest($appId, $adminUserName, $adminPassword)
      {
          $tree = new XML_Tree;
!         $root = &$tree->addRoot(AA_SERVICE_TAG);
          $listAppGroupNode = &$root->addChild('ListAppGroups');
!         $tmpNode = &$listAppGroupNode->addChild(APPLICATION_ID_TAG, '', array('value'=>"$appId"));
!         $tmpNode = &$listAppGroupNode->addChild(ADMIN_USER_NAME_TAG, '', array('value'=>"$adminUserName"));
!         $tmpNode = &$listAppGroupNode->addChild(ADMIN_PASSWORD_TAG, '', array('value'=>"$adminPassword"));
  
          return $tree->get();

Index: AAUser.class.php
===================================================================
RCS file: /usr/cvs/geeklog/A_and_A/client/AAUser.class.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** AAUser.class.php	28 Nov 2002 00:24:30 -0000	1.5
--- AAUser.class.php	10 Jan 2003 05:55:18 -0000	1.6
***************
*** 145,149 ****
      function changePassword($newPassword)
      {
!         $this->_aaResponseCode = AAServiceInterface::changePassword($this->_aaServer, $this->getAppId(), $this->getUserId(), $this->getPassword(), $newPassword, $this->_aaPort);
          if ($this->_aaResponseCode) {
              $this->setPassword($newPassword);
--- 145,149 ----
      function changePassword($newPassword)
      {
!         $this->_aaResponseCode = AAServiceInterface::changePassword($this->_aaServer, $this->getAppId(), $this->getUserName(), $this->getPassword(), $newPassword, $this->_aaPort);
          if ($this->_aaResponseCode) {
              $this->setPassword($newPassword);
***************
*** 163,178 ****
      * 
      */
!     function changePasswordByAdmin($userId, $newPassword)
      {
!         $this->_aaResponseCode = AAServiceInterface::changePasswordByAdmin($this->_aaServer, $this->getAppId(), $this->getUserId(), $this->getPassword(), $userId, $newPassword);
          return $this->_aaResponseCode;
      }
  
!     function resetPassword($userId)
      {
!         $this->_aaResponseCode = AAServiceInterface::resetPassword($this->_aaServer, $this->getAppId(), $this->getUserId(), $this->getPassword(), $userId);
          return $this->_aaResponseCode;
      }
! 
      /**
      * Gets the application ID for this user object
--- 163,178 ----
      * 
      */
!     function changePasswordByAdmin($userName, $newPassword)
      {
!         $this->_aaResponseCode = AAServiceInterface::changePasswordByAdmin($this->_aaServer, $this->getAppId(), $this->getUserName(), $this->getPassword(), $userName, $newPassword);
          return $this->_aaResponseCode;
      }
  
!     function resetPassword($userName)
      {
!         $this->_aaResponseCode = AAServiceInterface::resetPassword($this->_aaServer, $this->getAppId(), $this->getUserName(), $this->getPassword(), $userName);
          return $this->_aaResponseCode;
      }
!     
      /**
      * Gets the application ID for this user object
***************
*** 196,199 ****
--- 196,204 ----
          return $this->_userId;
      }
+     
+     function getUserName()
+     {
+         return $this->_userName;
+     }
  
      /**
***************
*** 237,241 ****
      function getUserPrivileges($userId)
      {
!         return AAServiceInterface::getUserPrivileges($this->_aaServer, $this->getAppId(), $this->getUserId(), $this->getPassword(), $userId);
      }
  
--- 242,246 ----
      function getUserPrivileges($userId)
      {
!         return AAServiceInterface::getUserPrivileges($this->_aaServer, $this->getAppId(), $this->getUserName(), $this->getPassword(), $userId);
      }
  
***************
*** 250,254 ****
      function setUserPrivileges($userId, $privArray)
      {
!         return AAServiceInterface::setUserPrivileges($this->_aaServer, $this->getAppId(), $this->getUserId(), $this->getPassword(), $userId, $privArray);
      }
   
--- 255,259 ----
      function setUserPrivileges($userId, $privArray)
      {
!         return AAServiceInterface::setUserPrivileges($this->_aaServer, $this->getAppId(), $this->getUserName(), $this->getPassword(), $userId, $privArray);
      }
   
***************
*** 262,285 ****
      function listAppPrivileges()
      {
!         return AAServiceInterface::listAppPrivileges($this->_aaServer, $this->getAppId(), $this->getUserid(), $this->getPassword());
      }
      
      function listAppGroups()
      {
!         return AAServiceInterface::listAppGroups($this->_aaServer, $this->getAppId(), $this->getUserId(), $this->getPassword());
      }
     
      /**
-     * This method allows an admin user to reset the password for a specified
-     * user.  Returns a randomly generated password
-     *
-     * @return   string  New randomly generated password
-     *
-     */ 
-     function resetUserPassword($userId)
-     {
-     }
- 
-     /**
      * Sets the A&A Server for this user
      *
--- 267,279 ----
      function listAppPrivileges()
      {
!         return AAServiceInterface::listAppPrivileges($this->_aaServer, $this->getAppId(), $this->getUserName(), $this->getPassword());
      }
      
      function listAppGroups()
      {
!         return AAServiceInterface::listAppGroups($this->_aaServer, $this->getAppId(), $this->getUserName(), $this->getPassword());
      }
     
      /**
      * Sets the A&A Server for this user
      *
***************
*** 331,334 ****
--- 325,338 ----
          if (!empty($userId)) {
              $this->_userId = $userId;
+             return true;
+         } else {
+             return false;
+         }
+     }
+     
+     function setUserName($userName)
+     {
+         if (!empty($userName)) {
+             $this->_userName = $userName;
              return true;
          } else {





More information about the geeklog-cvs mailing list