[geeklog-cvs] geeklog-2/lib/A_and_A/client XMLInvoker.class.php,NONE,1.1
geeklog-cvs-admin at lists.geeklog.net
geeklog-cvs-admin at lists.geeklog.net
Fri May 16 17:16:57 EDT 2003
- Previous message (by thread): [geeklog-cvs] geeklog-2/lib/MVCnPHP ArrayLoader.class.php,NONE,1.1 BaseCommand.class.php,NONE,1.1 BaseLoader.class.php,NONE,1.1 BaseView.class.php,NONE,1.1 CHANGELOG,NONE,1.1 CommandFactory.class.php,NONE,1.1 Constants.php,NONE,1.1 Controller.class.php,NONE,1.1 Form.class.php,NONE,1.1 LoaderFactory.class.php,NONE,1.1 MVC_Base.class.php,NONE,1.1 MVC_XMLParser.class.php,NONE,1.1 Mapping.class.php,NONE,1.1 QF_View.class.php,NONE,1.1 README.txt,NONE,1.1 Validator.class.php,NONE,1.1 ViewFactory.class.php,NONE,1.1 XMLLoader.class.php,NONE,1.1
- Next message (by thread): [geeklog-cvs] geeklog-2/lib/A_and_A/client AAServiceInterface.class.php,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/cvs/geeklog/geeklog-2/lib/A_and_A/client
In directory internal.geeklog.net:/tmp/cvs-serv2598
Added Files:
XMLInvoker.class.php
Log Message:
Initial release of the XML Invoker strategy. This is the bulk of the code that use to be in AAServiceInterface.class.php. That class is being completely refactored to allow for other methods of talking to the A&A server.
--- NEW FILE: XMLInvoker.class.php ---
<?php
/**
* PEAR's XML tree builder
*/
require_once 'XML/Tree.php';
/**
* XMLInvoker to the A&A service.
*
* This class it the XML strategy for interacting
* with the A&A service.
*
* @author Tony Bibbs <tony at geeklog.net>
* @package net.geeklog.enterprise.aa.client
*
*/
class XMLInvoker extends Invoker {
var $_server = null;
var $_port = null;
var $_path = null;
/**
* Constructor
*
* Sets up the A&A server properties
*
*/
function XMLInvoker($aaServer, $aaPort, $aaPath)
{
if (emtpy($aaServer) OR empty($aaPort) OR empty($aaPath)) {
trigger_error('Missing paramater to XMLInvoker::XMLInvoker()', E_USER_ERROR);
}
$this->_server = $aaServer;
$this->_port = $aaPort;
$this->_path = $aaPath;
}
/**
* Authenticates a user to an application
*
* This method authenticates the userId and password for the specified
* application. It returns an AAUser object which holds authorization
* privieges for that user and any exeptions that may have occured
* during authentication
*
* @author Tony Bibbs <tony AT geeklog DOT net>
* @param string $appId Application to authenticate to
* @param string $userId User to authenticate
* @param string $password Password to authenticate with
* @return AAUser Object containing a list of authorization levels
*
*/
function &authenticate($appId, $userName, $password) {
// Build and send XML request
$requestXML = AAServiceInterface::_buildAuthenticateRequest($appId, $userName, $password);
$responseXML = AAServiceInterface::_request($aaServer,'POST',$aaPath,$requestXML,$aaPort);
$user = &AAServiceInterface::_handleAuthenticateResponse($responseXML, $aaServer, $aaPort);
if (get_class($user) == 'aaexception') {
// Doing this just to make it obvious that we got an exception, not a valid user object
$exception = &$user;
// Need to log this problem at some point, until then just return false
return false;
}
$user->setAppId($appId);
$user->setUserName($userName);
$user->setPassword($password);
return $user;
}
/**
* Changes a password for a user
*
* This method changes the password for the given userId, password and
* application ID combination.
*
* @author Tony Bibbs <tony AT geeklog DOT net>
* @param string $appId Application to change password for
* @param string $userId User to change password for
* @param string $password Current password
* @param string $newPassword New password
* @return boolean True if change worked, otherwise false
*
*/
function changePassword($appId, $userName, $password, $newPassword)
{
$requestXML = AAServiceInterface::_buildChangePasswordRequest($appId, $userName, $password, $newPassword);
$responseXML = AAServiceInterface::_request($aaServer,'POST','/~tony/server/A_and_A/',$requestXML,$aaPort);
$error = AAServiceInterface::_handleResponse($responseXML);
if ($error) {
return false;
}
return true;
}
/**
* Allows admin to change a user's password
*
* This method allows an admin user ot change the password of a user to a
* particular value.
*
* @author Tony Bibbs <tony at geeklog.net>
* @access public
* @param string $appId Application to change password for
* @param string $adminUserId User to change password for
* @param string $adminPassword Current password
* @param string $userId User to change password for
* @param string $newPassword New password
*
*/
function changePasswordByAdmin($appId, $adminUserName, $adminPassword, $userName, $newPassword)
{
$requestXML = AAServiceInterface::_buildChangePasswordByAdminRequest($appId, $adminUserName, $adminPassword, $userName, $newPassword);
$responseXML = AAServiceInterface::_request($aaServer,'POST','/~tony/server/A_and_A/',$requestXML,$aaPort);
$error = AAServiceInterface::_handleResponse($responseXML);
if ($error) {
return false;
}
return true;
}
function resetPassword($appId, $adminUserName, $adminPassword, $userName)
{
$requestXML = AAServiceInterface::_buildResetPasswordRequest($appId, $adminUserName, $adminPassword, $userName);
$responseXML = AAServiceInterface::_request($aaServer, 'POST', '/~tony/server/A_and_A/', $requestXML, $aaPort);
$newPassword = AAServiceInterface::_handleResetPasswordResponse($responseXML);
if (get_class($newPassword) == 'aaexception') {
return false;
}
return $newPassword;
}
/**
* Gets application priveliges for specified user
*
* This method retrieves the privilges of the specified user
*
* @param string $appId Application to get privilegs for
* @param string $adminUserId Admin making the request
* @param string $adminPassword Admin's password
* @param string $userId User to get privileges for
* @return AAPrivilegeInterface Object holding the user's privileges
*
*/
function getUserPrivileges($appId, $adminUserId, $adminPassword, $userIdcool)
{
$requestXML = AAServiceInterface::_buildGetUserPrivilegesRequest($appId, $adminUserId, $adminPassword, $userId);
$responseXML = AAServiceInterface::_request($aaServer, 'POST', '/entaaa/', $requestXML, $aaPort);
$privArray= AAServiceInterface::_handleGetUserPrivilegesResponse($responseXML);
if (get_class($privArray) == 'aaexception') {
return false;
}
return $privArray;
}
/**
* Sets the privileges for a given user and application
*
* @param string $appId App to set privileges for
* @param string $adminUserId Admin making the request
* @param string $adminPassword Admin's password
* @param string $userId User to set privileges for
* @param AAPrivilege[] $privileges Privileges to give to the user
*
*/
function setUserPrivileges($appId, $adminUserId, $adminPassword, $userId, $privArray)
{
$requestXML = AAServiceInterface::_buildSetUserPrivilegesRequest($appId, $adminUserId, $adminPassword, $userId, $privArray);
$responseXML = AAServiceInterface::_request($aaServer, 'POST', '/~tony/server/A_and_A/', $requestXML, $aaPort);
$error = AAServiceInterface::_handleResponse($responseXML);
if ($error) {
return false;
}
return true;
}
/**
* Lists all available privileges for a given application
*
* @param string $appId App to set privileges for
* @param string $adminUserId Admin making the request
* @param string $adminPassword Admin's password
* @return AAPrivilegeInterface Complete list of privileges
*
*/
function listAppPrivileges($aaServer, $appId, $adminUserName, $adminPassword, $aaPort=80)
{
$requestXML = AAServiceInterface::_buildListAppPrivilegesRequest($appId, $adminUserName, $adminPassword);
$responseXML = AAServiceInterface::_request($aaServer, 'POST', '/~tony/server/A_and_A/', $requestXML, $aaPort);
$privArray = AAServiceInterface::_handleListAppPrivilegesResponse($responseXML);
if (get_class($privArray) == 'aaexception') {
return false;
}
return $privArray;
}
function listAppGroups($appId, $adminUserName, $adminPassword)
{
$requestXML = AAServiceInterface::_buildListAppGroupsRequest($appId, $adminUserName, $adminPassword);
$responseXML = AAServiceInterface::_request($aaServer, 'POST', '/~tony/server/A_and_A/', $requestXML, $aaPort);
$groupArray = AAServiceInterface::_handleListAppGroupsResponse($responseXML);
if (get_class($groupArray) == 'aaexception') {
return false;
}
return $groupArray;
}
// Private Methods
/**
* Makes HTTP resquests and returns the results. Code take from
* http://dodds.net/~cardinal/sentohost.txt
*
* Examples: $this->_request('localhost','post','/search','q=php_imlib');
*
* @access private
* @param string $host Host to make request to
* @param string $method Method of request (POST or GET)
* @param string $data
* @param integer $port Port to connect to
* @param string $useragent
* @return string Response from the request
*
*/
function _request($host, $method, $path, $data, $port=80, $useragent=0)
{
// The following two lines are for testing only. This will test all methods against
// a mock server. The mock server makes no attempts to validate the incoming
// XML nor use any real provider. It simply prints a valid response for the
// method called. It is meant for regressing testing the client separate from
// the server.
//$host = 'localhost';
//$path = '/A_and_A/client/testscripts/mockserver.php';
//print "host: $host, method = $method, path = $path, port = $port";
//exit;
// We are doing a form post and this variable is always expected
$data = 'xmlInParam=' . $data;
// Xerces can't seem to handle any sort of whitespace
$data = str_replace("|",'',$data);
$data = str_replace("\n",'',$data);
$data = str_replace(' ','',$data);
$data = str_replace('> <','><',$data);
$data = stripslashes($data);
// Supply a default method of GET if the one passed was empty
if (empty($method)) {
$method = 'GET';
}
// Open the socket
$method = strtoupper($method);
$fp = fsockopen($host,$port);
if (!$fp) {
print 'error connect to A&A server in _request';
exit;
}
if ($method == 'GET') {
$path .= '?' . $data;
}
// Post the request
fputs($fp, "$method $path HTTP/1.1\n");
fputs($fp, "Host: $host\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
fputs($fp, "Content-length: " . strlen($data) . "\n");
if ($useragent) {
fputs($fp, "User-Agent: MSIE\n");
}
fputs($fp, "Connection: close\n\n");
if ($method == 'POST') {
fputs($fp, $data);
}
$response = '';
// Get the response
while (!feof($fp)) {
$response .= fgets($fp,128);
}
fclose($fp);
// Since we are reading from the socket let's get rid of any header
// info
$startPos = strpos($response,'<');
$endPos = strrpos($response,'>') + 1;
$length = ($endPos - $startPos) + 1;
$response = substr($response, $startPos, $length);
// Now we have just the XML
return $response;
}
/**
* Builds an XML request string for the A&A service
*
* @access private
* @param string $host Hostname or IP for A&A Server
* @param string $appId ID of application making the request
* @param string $userID ID of user to authenticate
* @param string $password Password to use
* @return string XML request is outputed.
*
*/
function _buildAuthenticateRequest($appId, $userId, $password)
{
$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();
}
/**
* Parses a XML response from the authenticate service method* and builds
* a user object
*
* @param string $responseXML XML returned from authenticate()
* @return AAUser User object
*
*/
function &_handleAuthenticateResponse($responseXML, $aaServer, $aaPort='80')
{
$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;
}
$user = new AAUser($aaServer, $aaPort);
$user->setEmpId($vals[$index['EMPID'][0]]);
$groupIndexes = $index['GROUP'];
$privIndexes = $index['PRIVILEGE'];
// Get all the groups
foreach ($groupIndexes as $curIndex) {
$curGroup = $vals[$curIndex];
$user->_groups[] = &AAServiceInterface::_buildGroup($curGroup);
}
// Get all the privileges
foreach ($privIndexes as $curIndex) {
$curPriv = $vals[$curIndex];
$user->_privileges[] = &AAServiceInterface::_buildPrivilege($curPriv);
}
return $user;
}
/**
* Generic response handler.
*
* This handles all responses from A&A server. This is called by all commands
* except for authenticate and privilege-related calls.
*
* @access private
* @param string $responseXML XML returned from changePasswordByAdmin()
*
*/
function _handleResponse($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 false;
}
/**
* Builds XML request string for A&A Service to change a user's password
*
* @access private
* @param string $appId Applicatoin ID
* @param string $userId User ID
* @param string $oldPassword Old password
* @param string $newPassword NewPassword
* @return string XML request
*
*/
function _buildChangePasswordRequest($appId, $userId, $oldPassword, $newPassword)
{
$tree = new XML_Tree;
$root = &$tree->addRoot(AA_SERVICE_TAG);
$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"));
return $tree->get();
}
/**
* Builds an XML request for A&A Service to call changePasswordByAdmin on server
*
* @access private
* @param string $appId Application ID
* @param string $userId User ID
* @param string $password Old password
* @param string $newPassword New Password
* @return string XML request
*
*/
function _buildChangePasswordByAdminRequest($appId, $adminUserId, $adminPassword, $userId, $newPassword)
{
$tree = new XML_Tree;
$root = &$tree->addRoot(AA_SERVICE_TAG);
$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"));
return $tree->get();
}
/**
* Handles the response from the A&A server to our request to changePasswordByAdmin
*
* @access private
* @param string $responseXML XML returned from changePasswordByAdmin
*
*/
function _handleChangePasswordByAdminResponse($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 true;
}
return false;
}
/**
* Builds an XML request for A&A Service to call resetPassword on server
*
* @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;
$root = &$tree->addRoot(AA_SERVICE_TAG);
$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
*
* @access private
* @param string $appId Application ID
* @param string $adminUserId Admin's user ID
* @param string $adminPassword Admin's password
* @param string $userId User to get privileges for
* @return string XML request
*
*/
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();
}
function _handleGetUserPrivilegesResponse($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;
}
$privIndexes = $index['PRIVILEGE'];
$privArray = array();
// Get all the privileges
foreach ($privIndexes as $curIndex) {
$curPriv = $vals[$curIndex];
$privArray[] = &AAServiceInterface::_buildPrivilege($curPriv);
}
return $privArray;
}
/**
* Builds an XML request for A&A Service to call setUserPrivileges on server
*
* @access private
* @param string $appId Application ID
* @param string $adminUserId Admin's user ID
* @param string $adminPassword Admin's password
* @param string $userId User to set privileges for
* @param AAPrivilege[] $privileges Array of privileges to give user
* @return string XML request
*
*/
function _buildSetUserPrivilegesRequest($appId, $adminUserId, $adminPassword, $userId, $privileges)
{
$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()));
}
return $tree->get();
}
function _handleSetUserPrivilegesResponse($responseXML)
{
}
/**
* Builds an XML request for A&A Service to call listAllPrivileges on server
*
* @access private
* @param string $appId Application ID
* @param string $adminUserId Admin's user ID
* @param string $adminPassword Admin's password
* @return AAPrivilege[] Array of privileges
*
*/
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();
}
function _handleListAppPrivilegesResponse($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;
}
$privIndexes = $index['PRIVILEGE'];
$privArray = array();
// Get all the privileges
foreach ($privIndexes as $curIndex) {
$curPriv = $vals[$curIndex];
$privArray[] = &AAServiceInterface::_buildPrivilege($curPriv);
}
return $privArray;
}
/**
* Builds an XML request for A&A Service to call listAllPrivileges on server
*
* @access private
* @param string $appId Application ID
* @param string $adminUserId Admin's user ID
* @param string $adminPassword Admin's password
* @return AAPrivilege[] Array of privileges
*
*/
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();
}
function _handleListAppGroupsResponse($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;
}
$groupArray = array();
$groupIndexes = $index['GROUP'];
// Get all the groups
foreach ($groupIndexes as $curIndex) {
$curGroupVals = $vals[$curIndex];
$curGroup = &AAServiceInterface::_buildGroup($curGroupVals);
$privIndexes = $index['PRIVILEGE'];
// Get all the privileges
foreach ($privIndexes as $curIndex) {
$curPriv = $vals[$curIndex];
$curGroup->_privileges[] = &AAServiceInterface::_buildPrivilege($curPriv);
}
$groupArray[] = $curGroup;
}
return $groupArray;
}
/**
* Return a group object built from a string array
*
* @access private
* @param string[] String array to create group from
* @return AAGroup Group object
*
*/
function &_buildGroup($groupArray)
{
// Make sure we got a good array
is_array($groupArray) or die ('_buildGroup did not get a valid array sent to it');
$curGroup = new AAGroup();
$curGroup->setGroupId($groupArray['attributes']['ID']);
$curGroup->setGroupLogicalName($groupArray['attributes']['LOGICAL']);
$curGroup->setGroupId($groupArray['attributes']['DISPLAY']);
$curGroup->setGroupDesc($groupArray['value']);
/*$privIndexes = $index['PRIVILEGE'];
// Get all the privileges
foreach ($privIndexes as $curIndex) {
$curPriv = $vals[$curIndex];
$user->_privileges[] = &AAServiceInterface::_buildPrivilege($curPriv);
}*/
return $curGroup;
}
/**
* Return a privilige object built from a string array
*
* @access private
* @param string[] String array to create privilege from
* @return AAPrivilege Privilege object
*
*/
function &_buildPrivilege($privilegeArray)
{
// Make sure we got a good array
is_array($privilegeArray) or die ('_buildPrivilege did not get a valid array sent to it');
$privilege = new AAPrivilege();
$privilege->setPrivilegeCode($privilegeArray['attributes']['CODE']);
$privilege->setPrivilegeDesc($privilegeArray['value']);
return $privilege;
}
/**
* Checks to see if we received some sort of exception
*
* @access private
* @param string $responseXML
* @return object|boolean returns an exception object, otherwise false
*
*/
function _exceptionCheck($index, $vals)
{
$retval = $vals[$index['RESULT'][0]]['attributes']['VALUE'];
if ($retval == 0) {
return false;
}
$exception = new AAException($retval);
$exception->message = $vals[$index['RESULT'][0]]['value'];
return $exception;
}
}
?>
- Previous message (by thread): [geeklog-cvs] geeklog-2/lib/MVCnPHP ArrayLoader.class.php,NONE,1.1 BaseCommand.class.php,NONE,1.1 BaseLoader.class.php,NONE,1.1 BaseView.class.php,NONE,1.1 CHANGELOG,NONE,1.1 CommandFactory.class.php,NONE,1.1 Constants.php,NONE,1.1 Controller.class.php,NONE,1.1 Form.class.php,NONE,1.1 LoaderFactory.class.php,NONE,1.1 MVC_Base.class.php,NONE,1.1 MVC_XMLParser.class.php,NONE,1.1 Mapping.class.php,NONE,1.1 QF_View.class.php,NONE,1.1 README.txt,NONE,1.1 Validator.class.php,NONE,1.1 ViewFactory.class.php,NONE,1.1 XMLLoader.class.php,NONE,1.1
- Next message (by thread): [geeklog-cvs] geeklog-2/lib/A_and_A/client AAServiceInterface.class.php,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the geeklog-cvs
mailing list