Class: Fog::Proxmox::Identity::User
- Inherits:
-
Model
- Object
- Model
- Fog::Proxmox::Identity::User
- Defined in:
- lib/fog/proxmox/identity/models/user.rb
Overview
class User model
Instance Method Summary collapse
- #change_password ⇒ Object
- #destroy ⇒ Object
-
#initialize(new_attributes = {}) ⇒ User
constructor
A new instance of User.
- #permissions(path = nil) ⇒ Object
- #save(options = {}) ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(new_attributes = {}) ⇒ User
Returns a new instance of User.
39 40 41 42 43 44 45 |
# 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 |
Instance Method Details
#change_password ⇒ Object
64 65 66 67 |
# File 'lib/fog/proxmox/identity/models/user.rb', line 64 def change_password requires :userid, :password service.change_password(userid, password) end |
#destroy ⇒ Object
52 53 54 55 56 |
# File 'lib/fog/proxmox/identity/models/user.rb', line 52 def destroy requires :userid service.delete_user(userid) true end |
#permissions(path = nil) ⇒ Object
69 70 71 72 |
# File 'lib/fog/proxmox/identity/models/user.rb', line 69 def (path = nil) requires :userid attributes[:permissions] = service.(userid, path) end |
#save(options = {}) ⇒ Object
47 48 49 50 |
# File 'lib/fog/proxmox/identity/models/user.rb', line 47 def save( = {}) service.create_user((attributes.reject { |attribute| [:tokens].include? attribute }).merge()) reload end |
#update ⇒ Object
58 59 60 61 62 |
# File 'lib/fog/proxmox/identity/models/user.rb', line 58 def update requires :userid service.update_user(userid, attributes.reject { |attribute| %i[userid tokens].include? attribute }) reload end |