class Fog::Proxmox::Identity::User

class User model

Public Class Methods

new(new_attributes = {}) click to toggle source
Calls superclass method
# File lib/fog/proxmox/identity/models/user.rb, line 39
def initialize(new_attributes = {})
  prepare_service_value(new_attributes)
  Fog::Proxmox::Attributes.set_attr_and_sym('userid', attributes, new_attributes)
  requires :userid
  initialize_tokens
  super(new_attributes)
end

Public Instance Methods

change_password() click to toggle source
# File lib/fog/proxmox/identity/models/user.rb, line 64
def change_password
  requires :userid, :password
  service.change_password(userid, password)
end
destroy() click to toggle source
# File lib/fog/proxmox/identity/models/user.rb, line 52
def destroy
  requires :userid
  service.delete_user(userid)
  true
end
permissions(path = nil) click to toggle source
# File lib/fog/proxmox/identity/models/user.rb, line 69
def permissions(path = nil)
  requires :userid
  attributes[:permissions] = service.list_user_permissions(userid, path)
end
save(options = {}) click to toggle source
# File lib/fog/proxmox/identity/models/user.rb, line 47
def save(options = {})
  service.create_user((attributes.reject { |attribute| [:tokens].include? attribute }).merge(options))
  reload
end
update() click to toggle source
# File lib/fog/proxmox/identity/models/user.rb, line 58
def update
  requires :userid
  service.update_user(userid, attributes.reject { |attribute| [:userid, :tokens].include? attribute })
  reload
end

Private Instance Methods

initialize_tokens() click to toggle source
# File lib/fog/proxmox/identity/models/user.rb, line 76
def initialize_tokens
  attributes[:tokens] = Fog::Proxmox::Identity::Tokens.new(service: service, userid: userid)
end