mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-26 06:50:09 +03:00
feature #203: Removed unused user info method
This commit is contained in:
parent
8c04d92a2b
commit
89d60d65ea
@ -620,28 +620,6 @@ private:
|
||||
UserPool * upool;
|
||||
};
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
class UserInfo: public xmlrpc_c::method
|
||||
{
|
||||
public:
|
||||
UserInfo(UserPool * _upool):upool(_upool)
|
||||
{
|
||||
_signature="A:si";
|
||||
_help="Returns the Info of the user";
|
||||
};
|
||||
|
||||
~UserInfo(){};
|
||||
|
||||
void execute(
|
||||
xmlrpc_c::paramList const& paramList,
|
||||
xmlrpc_c::value * const retvalP);
|
||||
|
||||
private:
|
||||
UserPool * upool;
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
class UserDelete: public xmlrpc_c::method
|
||||
|
@ -264,9 +264,6 @@ void RequestManager::register_xml_methods()
|
||||
xmlrpc_c::methodPtr user_allocate(new
|
||||
RequestManager::UserAllocate(upool));
|
||||
|
||||
xmlrpc_c::methodPtr user_info(new
|
||||
RequestManager::UserInfo(upool));
|
||||
|
||||
xmlrpc_c::methodPtr user_delete(new
|
||||
RequestManager::UserDelete(upool));
|
||||
|
||||
@ -329,7 +326,6 @@ void RequestManager::register_xml_methods()
|
||||
/* User related methods*/
|
||||
|
||||
RequestManagerRegistry.addMethod("one.user.allocate", user_allocate);
|
||||
RequestManagerRegistry.addMethod("one.user.info", user_info);
|
||||
RequestManagerRegistry.addMethod("one.user.delete", user_delete);
|
||||
|
||||
RequestManagerRegistry.addMethod("one.userpool.info", userpool_info);
|
||||
|
@ -1,100 +0,0 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) */
|
||||
/* */
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
|
||||
/* not use this file except in compliance with the License. You may obtain */
|
||||
/* a copy of the License at */
|
||||
/* */
|
||||
/* http://www.apache.org/licenses/LICENSE-2.0 */
|
||||
/* */
|
||||
/* Unless required by applicable law or agreed to in writing, software */
|
||||
/* distributed under the License is distributed on an "AS IS" BASIS, */
|
||||
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
||||
/* See the License for the specific language governing permissions and */
|
||||
/* limitations under the License. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
#include "RequestManager.h"
|
||||
#include "NebulaLog.h"
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void RequestManager::UserInfo::execute(
|
||||
xmlrpc_c::paramList const& paramList,
|
||||
xmlrpc_c::value * const retval)
|
||||
{
|
||||
string session;
|
||||
int uid;
|
||||
|
||||
User * user;
|
||||
|
||||
int rc;
|
||||
ostringstream oss;
|
||||
|
||||
/* -- RPC specific vars -- */
|
||||
vector<xmlrpc_c::value> arrayData;
|
||||
xmlrpc_c::value_array * arrayresult;
|
||||
|
||||
NebulaLog::log("ReM",Log::DEBUG,"UserInfo method invoked");
|
||||
|
||||
// Get the parameters
|
||||
session = xmlrpc_c::value_string(paramList.getString(0));
|
||||
uid = xmlrpc_c::value_int(paramList.getInt(1));
|
||||
|
||||
// Only oneadmin can retrieve user information
|
||||
rc = UserInfo::upool->authenticate(session);
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
goto error_authenticate;
|
||||
}
|
||||
|
||||
// Now let's get the user
|
||||
user = UserInfo::upool->get(uid,true);
|
||||
|
||||
if ( user == 0 )
|
||||
{
|
||||
goto error_get_user;
|
||||
}
|
||||
|
||||
oss << *user;
|
||||
|
||||
user->unlock();
|
||||
|
||||
// All nice, return the new uid to client
|
||||
arrayData.push_back(xmlrpc_c::value_boolean(true)); // SUCCESS
|
||||
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
|
||||
|
||||
// Copy arrayresult into retval mem space
|
||||
arrayresult = new xmlrpc_c::value_array(arrayData);
|
||||
*retval = *arrayresult;
|
||||
|
||||
delete arrayresult; // and get rid of the original
|
||||
|
||||
return;
|
||||
|
||||
error_authenticate:
|
||||
oss << "User not authorized to retrieve user information";
|
||||
goto error_common;
|
||||
|
||||
error_get_user:
|
||||
oss << "Error getting user";
|
||||
goto error_common;
|
||||
|
||||
error_common:
|
||||
|
||||
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
|
||||
arrayData.push_back(xmlrpc_c::value_string(oss.str()));
|
||||
|
||||
NebulaLog::log("ReM",Log::ERROR,oss);
|
||||
|
||||
xmlrpc_c::value_array arrayresult_error(arrayData);
|
||||
|
||||
*retval = arrayresult_error;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
@ -48,7 +48,6 @@ source_files=[
|
||||
'RequestManagerVirtualNetworkPublish.cc',
|
||||
'RequestManagerVirtualNetworkDelete.cc',
|
||||
'RequestManagerUserAllocate.cc',
|
||||
'RequestManagerUserInfo.cc',
|
||||
'RequestManagerUserDelete.cc',
|
||||
'RequestManagerUserPoolInfo.cc'
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user