Revision 61120649 src/oca/ruby/OpenNebula/User.rb

View differences:

src/oca/ruby/OpenNebula/User.rb
26 26
            :allocate => "user.allocate",
27 27
            :delete   => "user.delete",
28 28
            :passwd   => "user.passwd",
29
            :chgrp    => "user.chgrp",
30
            :addgroup => "user.addgroup",
31
            :delgroup => "user.delgroup"
29
            :chgrp    => "user.chgrp"
32 30
        }
33 31

  
34 32
        SELF = -1
......
115 113
        def gid
116 114
            self['GID'].to_i
117 115
        end
118

  
119
        # Returns whether or not the user is part of the group 'gid'
120
        def is_part_of(gid)
121
            return self["GROUPS/ID[.=#{gid}]"] != nil
122
        end
123

  
124
        # Returns an array with the numeric group ids
125
        def group_ids
126
            array = Array.new
127

  
128
            self.each("GROUPS/ID") do |id|
129
                array << id.text.to_i
130
            end
131

  
132
            return array
133
        end
134 116
    end
135 117
end

Also available in: Unified diff