Class: Fog::Identity::Proxmox::Permission

Inherits:
Proxmox::Model show all
Defined in:
lib/fog/identity/proxmox/models/permission.rb

Overview

class Permission

Instance Method Summary collapse

Methods inherited from Proxmox::Model

#create, #destroy, #initialize, #inspect, #update

Constructor Details

This class inherits a constructor from Fog::Proxmox::Model

Instance Method Details

#==(other) ⇒ Object


45
46
47
# File 'lib/fog/identity/proxmox/models/permission.rb', line 45

def ==(other)
  to_s.eql? other.to_s if other
end

#addObject


49
50
51
# File 'lib/fog/identity/proxmox/models/permission.rb', line 49

def add
  service.add_permission(to_request)
end

#removeObject


53
54
55
# File 'lib/fog/identity/proxmox/models/permission.rb', line 53

def remove
  service.remove_permission(to_request)
end

#to_requestObject


57
58
59
60
61
62
63
64
65
# File 'lib/fog/identity/proxmox/models/permission.rb', line 57

def to_request
  request = { roles: roleid, path: path, propagate: propagate }
  if type == 'group'
    request.store(:groups, ugid)
  elsif type == 'user'
    request.store(:users, ugid)
  end
  request
end

#to_sObject


41
42
43
# File 'lib/fog/identity/proxmox/models/permission.rb', line 41

def to_s
  "path=#{path},roleid=#{roleid},type=#{type},ugid=#{ugid}"
end