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.



4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
# File 'lib/models/porcelain.rb', line 4809

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.



4803
4804
4805
# File 'lib/models/porcelain.rb', line 4803

def id
  @id
end

#resource_idObject

The id of the resource of this RoleGrant.



4805
4806
4807
# File 'lib/models/porcelain.rb', line 4805

def resource_id
  @resource_id
end

#role_idObject

The id of the attached role of this RoleGrant.



4807
4808
4809
# File 'lib/models/porcelain.rb', line 4807

def role_id
  @role_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



4825
4826
4827
4828
4829
4830
4831
# File 'lib/models/porcelain.rb', line 4825

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