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.



5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
# File 'lib/models/porcelain.rb', line 5199

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.



5193
5194
5195
# File 'lib/models/porcelain.rb', line 5193

def id
  @id
end

#resource_idObject

The id of the resource of this RoleGrant.



5195
5196
5197
# File 'lib/models/porcelain.rb', line 5195

def resource_id
  @resource_id
end

#role_idObject

The id of the attached role of this RoleGrant.



5197
5198
5199
# File 'lib/models/porcelain.rb', line 5197

def role_id
  @role_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



5215
5216
5217
5218
5219
5220
5221
# File 'lib/models/porcelain.rb', line 5215

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