1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

Merge branch 'master' of git.opennebula.org:one

This commit is contained in:
Jaime Melis 2011-04-11 19:37:23 +02:00
commit 9ef8c8715d
7 changed files with 36 additions and 107 deletions

View File

@ -1048,27 +1048,6 @@ private:
/* ---------------------------------------------------------------------- */
class UserAuthenticate: public xmlrpc_c::method
{
public:
UserAuthenticate(UserPool * _upool):upool(_upool)
{
_signature="A:s";
_help="Authenticates the user.";
};
~UserAuthenticate(){};
void execute(
xmlrpc_c::paramList const& paramList,
xmlrpc_c::value * const retvalP);
private:
UserPool * upool;
};
/* ---------------------------------------------------------------------- */
class UserInfo: public xmlrpc_c::method
{
public:

View File

@ -0,0 +1,34 @@
#!/usr/bin/env ruby
# -------------------------------------------------------------------------- #
# Copyright 2002-2011, 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. #
#--------------------------------------------------------------------------- #
data=STDIN.read.strip
data.each_line do |line|
next if !/^([^=]+?)=(.*)$/.match line
var_name="OPENNEBULA_#{$1}"
var_data=$2
var_type=/^\d+$/.match(var_data) ? 'uint32' : 'string'
command="gmetric -n #{var_name} -v \"#{var_data}\" -t #{var_type}"
system command
end

View File

@ -98,7 +98,7 @@ Any user can list available clusters.
Commands:
* create (Creates a new user)
* create (Creates a new cluster)
onecluster create clustername
* delete (Removes a cluster)

View File

@ -300,9 +300,6 @@ void RequestManager::register_xml_methods()
xmlrpc_c::methodPtr user_change_password(new
RequestManager::UserChangePassword(upool));
xmlrpc_c::methodPtr user_authenticate(new
RequestManager::UserAuthenticate(upool));
xmlrpc_c::methodPtr userpool_info(new
RequestManager::UserPoolInfo(upool));
@ -381,7 +378,6 @@ void RequestManager::register_xml_methods()
RequestManagerRegistry.addMethod("one.user.delete", user_delete);
RequestManagerRegistry.addMethod("one.user.info", user_info);
RequestManagerRegistry.addMethod("one.user.passwd", user_change_password);
RequestManagerRegistry.addMethod("one.user.authenticate",user_authenticate);
RequestManagerRegistry.addMethod("one.userpool.info", userpool_info);

View File

@ -1,79 +0,0 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, 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"
#include "AuthManager.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void RequestManager::UserAuthenticate::execute(
xmlrpc_c::paramList const& paramList,
xmlrpc_c::value * const retval)
{
string session;
int uid;
ostringstream oss;
const string method_name = "UserAuthenticate";
/* -- RPC specific vars -- */
vector<xmlrpc_c::value> arrayData;
xmlrpc_c::value_array * arrayresult;
NebulaLog::log("ReM",Log::DEBUG,"UserAuthenticate method invoked");
// Get the parameters
session = xmlrpc_c::value_string(paramList.getString(0));
// Try to authenticate the user
uid = UserAuthenticate::upool->authenticate(session);
if( uid == -1 )
{
goto error_common;
}
//Result
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;
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;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

View File

@ -60,7 +60,6 @@ source_files=[
'RequestManagerUserAllocate.cc',
'RequestManagerUserDelete.cc',
'RequestManagerUserChangePassword.cc',
'RequestManagerUserAuthenticate.cc',
'RequestManagerUserInfo.cc',
'RequestManagerUserPoolInfo.cc'
]

View File

@ -15,6 +15,6 @@
#--------------------------------------------------------------------------- #
# To change the directory where the VMM scripts are copied on the remote node
# uncomment and change the path of IM_REMOTE_DIR
# uncomment and change the path of VMMM_REMOTE_DIR
#
#VMM_REMOTE_DIR=/tmp/ne_im_scripts