[geeklog-cvs] geeklog-2/lib/A_and_A/client AAService.class.php,NONE,1.1
geeklog-cvs-admin at lists.geeklog.net
geeklog-cvs-admin at lists.geeklog.net
Fri Jul 11 16:18:59 EDT 2003
Update of /usr/cvs/geeklog/geeklog-2/lib/A_and_A/client
In directory internal.geeklog.net:/tmp/cvs-serv28621
Added Files:
AAService.class.php
Log Message:
This is a proxy class that will send A&A service request to the right invoker.
--- NEW FILE: AAService.class.php ---
<?php
/* Reminder: always indent with 4 spaces (no tabs). */
/**
* Enterprise Authentication & Authorization Service (A&A)
*
* The license for this software is yet to be determined. In the meantime,
* all rights are reserved. Use of this software is not permitted without
* the expressed written consent of Tony Bibbs
*
* @author Tony Bibbs <tony at geeklog.net>
* @copyright Tony Bibbs 2003
* @version $Id: AAService.class.php,v 1.1 2003/07/11 20:18:57 tony Exp $
*
*/
/**
* A&A User Class
*/
require_once 'A_and_A/client/AAUser.class.php';
/**
* Constants for the Enterprise A&A services and client
*/
require_once 'A_and_A/common/AAConstants.php';
/**
* Privilege class for the A&A Service
*/
require_once 'A_and_A/common/AAPrivilege.class.php';
/**
* Group class for the A&A Service
*/
require_once 'A_and_A/common/AAGroup.class.php';
/**
* Abstract invoker class
*/
require_once 'A_and_A/client/Invoker.class.php';
require_once 'A_and_A/common/AAServiceInterface.class.php';
define('INVOKE_LOCALHOST', 'LocalhostInvoker');
define('INVOKE_XMLRPC', 'RPCInvoker');
define('INVOKE_SOAP', 'SoapInvoker');
/**
* This is the service interface. It is basically a proxy class. Only the
* authenticate() method should be called directly. That method will return a user object
* that will let you perform all other authentication and authorization functions.
* Additionally, this is the only file you should need to include as this file
* includes all other required files.
*
* @author Tony Bibbs <tony at geeklog.net>
* @package net.geeklog.enterprise.aa.client
*/
class AAService implements AAServiceInterface {
private $_invoker = null;
/**
* Constructor
*
* Implements a strategy pattern for interacting with the A&A server in
* one of three ways:
* 1) XMLRPC - This strategy uses PEAR's XMLRPC package to talk to A&A
* 2) SOAP - This strategy uses SOAP/WSDL to talk to A&A server.
*
* @author Tony Bibbs <tony at geeklog.net>
* @access public
* @param $invokeMethod string Constant representing class of strategy to use
* @param $aaServer string hostname of A&A server
* @param $aaPort integer port to use when connecting to A&A server
* @param $aaPath string Relative path to send A&A requests to
* @return object User object
*
*/
function __construct($invokeMethod = INVOKE_LOCALHOST, $aaServer = '', $aaPort = '', $aaPath = '')
{
require_once 'A_and_A/client/' . $invokeMethod . '.class.php';
$this->_invoker = new $invokeMethod($aaServer, $aaPort, $aaPath);
}
/**
* Authenticates a user to an application
*
* This is a pass through method that sends the authentication request on
* to the invoker.
*
* @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
*
*/
public function authenticate($appId, $userName, $password)
{
return $this->_invoker->authenticate($appId, $userName, $password);
}
/**
* Changes a password for a user
*
* This is a pass through method that sends the change password request
* on to the invoker.
*
* @author Tony Bibbs <tony at geeklog.net>
* @access public
* @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
*
*/
public function changePassword($appId, $userName, $password, $newPassword)
{
return $this->_invoker->changePassword($appId, $userName, $password, $newPassword);
}
/**
* Allows admin to change a user's password
*
* Pass through method to the invoker's changePasswordByAdmin function
*
* @author Tony Bibbs <tony at geeklog.net>
* @access public
* @param string $appId Application to change password for
* @param string $adminUserId Admin's username
* @param string $adminPassword Admin's current password
* @param string $userId User to change password for
* @param string $newPassword New password
*
*/
public function changePasswordByAdmin($appId, $adminUserName, $adminPassword, $userName, $newPassword)
{
return $this->_invoker->changePasswordByAdmin($appId, $adminUserName, $adminPassword, $userName, $newPassword);
}
/**
* Resets a user's password
*
* @author Tony BIbbs <tony at geeklog.net>
* @access public
* @param string $appId Application to perform action on
* @param string $adminUserName Admin's username
* @param string $adminPassword Admin's password
* @return string New password
*
*/
public function resetPassword($appId, $adminUserName, $adminPassword, $userName)
{
return $this->_invoker->resetPassword($appId, $adminUserName, $adminPassword, $userName);
}
/**
* 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
*
*/
public function getUserPrivileges($appId, $adminUserName, $adminPass, $userName)
{
return $this->_invoker->getUserPrivileges($appId, $adminUserName, $adminPass);
}
/**
* 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
*
*/
public function setUserPrivileges($appId, $adminUserName, $adminPass, $userName, $privArray)
{
return $this->_invoker->setUserPrivileges($appId, $adminUserName, $adminPass, $userName, $privArray);
}
/**
* 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
*
*/
public function listAppPrivileges($appId, $adminUserName, $adminPassword)
{
return $this->_invoker->listAppPrivileges($appId, $adminUserName, $adminPassword);
}
/**
* Retrieves all existing security groups for a given application
*
* @author Tony Bibbs <tony at geeklog.net>
* @access public
* @param string $appId Application to get security groups for
* @param string $adminUserName Username for the administrator
* @param string $adminPass Administrator's password
*
*/
public function listAppGroups($appId, $adminUserName, $adminPassword)
{
return $this->_invoker->listAppGroups($appId, $adminUserName, $adminPassword);
}
/**
* Gets the privileges for a given user and application
*
* @author Tony Bibbs <tony at geeklog.net>
* @access public
* @param string $appId ID to operate against
* @param string $userName User to get privileges for
*
*/
public function getPrivileges($appId, $userName)
{
return $this->_invoker->getPrivileges($appId, $userName);
}
/**
* Gets the security groups for a given user and application
*
* @author Tony Bibbs <tony at geeklog.net>
* @access public
* @param string $appId Application to operate against
* @param string $userName User to get security groups for.
*
*/
public function getGroups($appId, $userName)
{
return $this->_invoker->getGroups($appId, $userName);
}
}
?>
More information about the geeklog-cvs
mailing list