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

feature #667: Improved ACLs CLI

(cherry picked from commit e3314e9a236451fdc18045058d123dedd3fa833f)

Conflicts:

	src/oca/ruby/OpenNebula/AclPool.rb
This commit is contained in:
Tino Vázquez 2011-07-05 18:58:25 +02:00
parent bd290d8dad
commit 4a186ea046
3 changed files with 6 additions and 10 deletions

View File

@ -35,10 +35,10 @@ class OneAclHelper < OpenNebulaHelper::OneHelper
end
if OpenNebula.is_error?(rc)
[-1, rc.message]
return [-1, rc.message]
else
if !rc
puts "Rule added" if options[:verbose]
if rc.class == Fixnum
puts "Rule added with ID #{rc}" if options[:verbose]
return 0
end
return [-1, rc[:users].message] if OpenNebula.is_error?(rc[:users])

View File

@ -54,7 +54,7 @@ cmd = CommandParser::CmdParser.new(ARGV) do
Adds a new ACL rule
EOT
command :addrule, addrule_desc, [:user,:rulestr], [:resource, nil], [:rights, nil] do
command :create, addrule_desc, [:user,:rulestr], [:resource, nil], [:rights, nil] do
helper.add_rule(options, args[0], args[1], args[2] )
end
@ -62,7 +62,7 @@ cmd = CommandParser::CmdParser.new(ARGV) do
Deletes an existing ACL rule
EOT
command :delrule, delrule_desc, :id do
command :delete, delrule_desc, :id do
helper.delete_rule( options, args[0] )
end

View File

@ -56,14 +56,10 @@ module OpenNebula
# +resource+ A string containing a hex number, e.g. 0x2100000001
# +rights+ A string containing a hex number, e.g. 0x10
def addrule(user, resource, rights)
rc = @client.call( ACL_POOL_METHODS[:addrule],
return @client.call( ACL_POOL_METHODS[:addrule],
user,
resource,
rights )
rc = nil if !OpenNebula.is_error?(rc)
return rc
end
# Adds a new ACL rule.