Class: SDM::RoleGrant

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

A RoleGrant connects a resource to a role, granting members of the role access to that resource.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, resource_id: nil, role_id: nil) ⇒ RoleGrant

Returns a new instance of RoleGrant.



4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
# File 'lib/models/porcelain.rb', line 4842

def initialize(
  id: nil,
  resource_id: nil,
  role_id: nil
)
  if id != nil
    @id = id
  end
  if resource_id != nil
    @resource_id = resource_id
  end
  if role_id != nil
    @role_id = role_id
  end
end

Instance Attribute Details

#idObject

Unique identifier of the RoleGrant.



4836
4837
4838
# File 'lib/models/porcelain.rb', line 4836

def id
  @id
end

#resource_idObject

The id of the resource of this RoleGrant.



4838
4839
4840
# File 'lib/models/porcelain.rb', line 4838

def resource_id
  @resource_id
end

#role_idObject

The id of the attached role of this RoleGrant.



4840
4841
4842
# File 'lib/models/porcelain.rb', line 4840

def role_id
  @role_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



4858
4859
4860
4861
4862
4863
4864
# File 'lib/models/porcelain.rb', line 4858

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end