PoolElement
Driver name for default core authentication
Driver name for default core authentication
Driver name for ssh authentication
Constants and Class Methods
Driver name for x509 authentication
Driver name for x509 proxy authentication
Creates a User description with just its identifier this method should be used to create plain User objects. id the id of the user
Example:
user = User.new(User.build_xml(3),rpc_client)
# File lib/opennebula/user.rb, line 63 def User.build_xml(pe_id=nil) if pe_id user_xml = "<USER><ID>#{pe_id}</ID></USER>" else user_xml = "<USER></USER>" end XMLElement.build_xml(user_xml, 'USER') end
Allocates a new User in OpenNebula
username Name of the new user.
password Password for the new user
# File lib/opennebula/user.rb, line 96 def allocate(username, password, driver=CORE_AUTH) super(USER_METHODS[:allocate], username, password, driver) end
Changes the auth driver and the password of the given User
@param auth [String] the new auth driver @param password [String] the new password. If it is an empty string,
the user password is not changed
@return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/user.rb, line 165 def chauth(auth, password="") return Error.new('ID not defined') if !@pe_id rc = @client.call(USER_METHODS[:chauth],@pe_id, auth, password) rc = nil if !OpenNebula.is_error?(rc) return rc end
Changes the primary group
gid |
Integer the new group id. Set to -1 to leave the current one |
nil in case of success or an Error object
# File lib/opennebula/user.rb, line 132 def chgrp(gid) return Error.new('ID not defined') if !@pe_id rc = @client.call(USER_METHODS[:chgrp],@pe_id, gid) rc = nil if !OpenNebula.is_error?(rc) return rc end
Deletes the User
# File lib/opennebula/user.rb, line 113 def delete() super(USER_METHODS[:delete]) end
Returns the group identifier
Integer the element's group ID
# File lib/opennebula/user.rb, line 194 def gid self['GID'].to_i end
Returns a list with all the group IDs for the user including primary
Array with the group ID's (as integers)
# File lib/opennebula/user.rb, line 200 def groups all_groups = self.retrieve_elements("GROUPS/ID") all_groups.collect! {|x| x.to_i} end
Retrieves the information of the given User.
# File lib/opennebula/user.rb, line 85 def info() super(USER_METHODS[:info], 'USER') end
Changes the password of the given User
password String containing the new password
# File lib/opennebula/user.rb, line 120 def passwd(password) return Error.new('ID not defined') if !@pe_id rc = @client.call(USER_METHODS[:passwd], @pe_id, password) rc = nil if !OpenNebula.is_error?(rc) return rc end
Sets the user 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
# File lib/opennebula/user.rb, line 179 def set_quota(quota) return Error.new('ID not defined') if !@pe_id rc = @client.call(USER_METHODS[:quota],@pe_id, quota) rc = nil if !OpenNebula.is_error?(rc) return rc end
Replaces the template contents
@param new_template [String] New template contents @param append [true, false] True to append new attributes instead of
replace the whole template
@return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/user.rb, line 108 def update(new_template, append=false) super(USER_METHODS[:update], new_template, append ? 1 : 0) end
Generated with the Darkfish Rdoc Generator 2.