class Fog::Proxmox::Identity::Permission

class Permission

Public Instance Methods

destroy() click to toggle source
# File lib/fog/proxmox/identity/models/permission.rb, line 34
def destroy
  service.update_permissions(to_update.merge(delete: 1))
end
save() click to toggle source
# File lib/fog/proxmox/identity/models/permission.rb, line 30
def save
  service.update_permissions(to_update)
end

Private Instance Methods

initialize_roles(new_attributes = {}) click to toggle source
# File lib/fog/proxmox/identity/models/permission.rb, line 40
def initialize_roles(new_attributes = {})
  roles = new_attributes.delete(:roleid)
  new_attributes.store(:roles, roles)       
end
initialize_ugid(new_attributes = {}) click to toggle source
# File lib/fog/proxmox/identity/models/permission.rb, line 45
def initialize_ugid(new_attributes = {})
  ugs = new_attributes.delete(:ugid)
  if type === 'user'
    new_attributes.store(:users, ugs)
  elsif type === 'group'
    new_attributes.store(:groups, ugs)
  end
  new_attributes.delete(:type)          
end
to_update() click to toggle source
# File lib/fog/proxmox/identity/models/permission.rb, line 55
def to_update
  new_attributes = attributes.clone
  initialize_roles(new_attributes)
  initialize_ugid(new_attributes)
  new_attributes
end