lib/cloudstack-cli/commands/user.rb in cloudstack-cli-0.15.1 vs lib/cloudstack-cli/commands/user.rb in cloudstack-cli-1.0.0.rc1
- old
+ new
@@ -1,29 +1,24 @@
class User < CloudstackCli::Base
- USER_TYPES = {
- 0 => 'user',
- 1 => 'domain-admin',
- 2 => 'admin'
- }
-
desc 'list', 'list users'
option :listall
option :account
def list
+ resolve_account
users = client.list_users(options)
if users.size < 1
say "No users found."
else
table = [["Account", "Type", "Name", "Email", "State", "Domain"]]
users.each do |user|
table << [
- user['account'], USER_TYPES[user['accounttype']], "#{user['firstname']} #{user['lastname']}",
+ user['account'], Account::TYPES[user['accounttype']], "#{user['firstname']} #{user['lastname']}",
user['email'], user['state'], user['domain']
]
end
print_table table
say "Total number of users: #{users.size}"
end
end
-
-end
\ No newline at end of file
+
+end