mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Feature #552: one.user.authenticate method now returns the User ID
This commit is contained in:
parent
bafa380a29
commit
fd6a54392b
@ -26,8 +26,12 @@ void RequestManager::UserAuthenticate::execute(
|
||||
xmlrpc_c::paramList const& paramList,
|
||||
xmlrpc_c::value * const retval)
|
||||
{
|
||||
string session;
|
||||
int rc;
|
||||
string session;
|
||||
int uid;
|
||||
|
||||
ostringstream oss;
|
||||
const string method_name = "UserAuthenticate";
|
||||
|
||||
|
||||
/* -- RPC specific vars -- */
|
||||
vector<xmlrpc_c::value> arrayData;
|
||||
@ -39,10 +43,16 @@ void RequestManager::UserAuthenticate::execute(
|
||||
session = xmlrpc_c::value_string(paramList.getString(0));
|
||||
|
||||
// Try to authenticate the user
|
||||
rc = UserAuthenticate::upool->authenticate(session);
|
||||
uid = UserAuthenticate::upool->authenticate(session);
|
||||
|
||||
if( uid == -1 )
|
||||
{
|
||||
goto error_common;
|
||||
}
|
||||
|
||||
//Result
|
||||
arrayData.push_back(xmlrpc_c::value_boolean( rc == 0 ));
|
||||
arrayData.push_back(xmlrpc_c::value_boolean( true ));
|
||||
arrayData.push_back(xmlrpc_c::value_int(uid));
|
||||
arrayresult = new xmlrpc_c::value_array(arrayData);
|
||||
|
||||
*retval = *arrayresult;
|
||||
@ -50,6 +60,19 @@ void RequestManager::UserAuthenticate::execute(
|
||||
delete arrayresult;
|
||||
|
||||
return;
|
||||
|
||||
error_common:
|
||||
oss.str(authenticate_error(method_name));
|
||||
|
||||
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
|
||||
arrayData.push_back(xmlrpc_c::value_string( authenticate_error(method_name) );
|
||||
|
||||
NebulaLog::log("ReM",Log::ERROR,oss);
|
||||
|
||||
xmlrpc_c::value_array arrayresult_error(arrayData);
|
||||
|
||||
*retval = arrayresult_error;
|
||||
return;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
Loading…
x
Reference in New Issue
Block a user