1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-19 06:50:07 +03:00

Merge branch 'bug-847' of git.opennebula.org:one into bug-847

This commit is contained in:
Ruben S. Montero 2011-10-25 18:21:24 +02:00
commit 2f1fad09cc
3 changed files with 24 additions and 2 deletions

View File

@ -82,6 +82,21 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
return 0, auth.password
end
# Returns the driver to be used for 'oneuser create'
# @param options [Hash] oneuser command options
# @return [String] the authentication driver to use
def driver(options)
if options[:driver]
return options[:driver]
elsif options[:ssh]
return OpenNebula::User::SSH_AUTH
elsif options[:x509]
return OpenNebula::User::X509_AUTH
else
return OpenNebula::User::CORE_AUTH
end
end
def self.login(username, options)
if options[:ssh]
require 'ssh_auth'

View File

@ -159,8 +159,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
end
driver = helper.driver(options)
helper.create_resource(options) do |user|
driver = options[:driver] || OpenNebula::User::CORE_AUTH
user.allocate(args[0], pass, driver)
end
end

View File

@ -35,9 +35,15 @@ module OpenNebula
SELF = -1
#Selects core authentication driver
# Driver name for default core authentication
CORE_AUTH = "core"
# Driver name for ssh authentication
SSH_AUTH = "ssh"
# Driver name for x509 authentication
X509_AUTH = "x509"
# Creates a User description with just its identifier
# this method should be used to create plain User objects.
# +id+ the id of the user