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.



6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
# File 'lib/models/porcelain.rb', line 6450

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.



6444
6445
6446
# File 'lib/models/porcelain.rb', line 6444

def id
  @id
end

#resource_idObject

The id of the resource of this RoleGrant.



6446
6447
6448
# File 'lib/models/porcelain.rb', line 6446

def resource_id
  @resource_id
end

#role_idObject

The id of the attached role of this RoleGrant.



6448
6449
6450
# File 'lib/models/porcelain.rb', line 6448

def role_id
  @role_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6466
6467
6468
6469
6470
6471
6472
# File 'lib/models/porcelain.rb', line 6466

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