Class: Fog::Identity::Proxmox::Permissions

Inherits:
Proxmox::Collection show all
Defined in:
lib/fog/identity/proxmox/models/permissions.rb

Overview

class Permissions authentication

Instance Attribute Summary

Attributes inherited from Proxmox::Collection

#response

Instance Method Summary collapse

Methods inherited from Proxmox::Collection

#clear_ignored_attributes, #destroy, #find_by_id, #get, #load_response, #not_implemented, #read, #summary

Instance Method Details

#add(permission) ⇒ Object


51
52
53
# File 'lib/fog/identity/proxmox/models/permissions.rb', line 51

def add(permission)
  create(permission).add
end

#all(_options = {}) ⇒ Object


30
31
32
# File 'lib/fog/identity/proxmox/models/permissions.rb', line 30

def all(_options = {})
  load_response(service.list_permissions, 'permissions')
end

#create(permission_hash) ⇒ Object


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fog/identity/proxmox/models/permissions.rb', line 34

def create(permission_hash)
  groups = permission_hash[:groups]
  users = permission_hash[:users]
  roles = permission_hash[:roles]
  path = permission_hash[:path]
  propagate ||= 1
  permission = new(path: path, propagate: propagate, roleid: roles)
  if groups
    permission.type = 'group'
    permission.ugid = groups
  elsif users
    permission.type = 'user'
    permission.ugid = users
  end
  permission
end

#remove(permission) ⇒ Object


55
56
57
# File 'lib/fog/identity/proxmox/models/permissions.rb', line 55

def remove(permission)
  create(permission).remove
end