From c94ff96cd740721373498636a8fbf212ec5773f1 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 13 Mar 2014 13:49:00 +0100 Subject: [PATCH] Add OpenNebula::User::group methods to get all groups from a user --- src/oca/ruby/opennebula/user.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/oca/ruby/opennebula/user.rb b/src/oca/ruby/opennebula/user.rb index f2afffcfe8..ed11486eba 100644 --- a/src/oca/ruby/opennebula/user.rb +++ b/src/oca/ruby/opennebula/user.rb @@ -172,8 +172,8 @@ module OpenNebula end # Sets the user quota limits - # @param quota [String] a template (XML or txt) with the new quota limits - # + # @param quota [String] a template (XML or txt) with the new quota limits + # # @return [nil, OpenNebula::Error] nil in case of success, Error # otherwise def set_quota(quota) @@ -194,5 +194,12 @@ module OpenNebula def gid self['GID'].to_i end + + # Returns a list with all the group IDs for the user including primary + # [return] _Array_ with the group ID's (as integers) + def groups + all_groups = self.retrieve_elements("GROUPS/ID") + all_groups.collect! {|x| x.to_i} + end end end