Class: SDM::Role

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

Overview

A Role is a collection of access grants, and typically corresponds to a team, Active Directory OU, or other organizational unit. Users are granted access to resources by assigning them to roles.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, name: nil, composite: nil, tags: nil) ⇒ Role

Returns a new instance of Role.



5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
# File 'lib/models/porcelain.rb', line 5010

def initialize(
  id: nil,
  name: nil,
  composite: nil,
  tags: nil
)
  if id != nil
    @id = id
  end
  if name != nil
    @name = name
  end
  if composite != nil
    @composite = composite
  end
  if tags != nil
    @tags = tags
  end
end

Instance Attribute Details

#compositeObject

True if the Role is a composite role.



5006
5007
5008
# File 'lib/models/porcelain.rb', line 5006

def composite
  @composite
end

#idObject

Unique identifier of the Role.



5002
5003
5004
# File 'lib/models/porcelain.rb', line 5002

def id
  @id
end

#nameObject

Unique human-readable name of the Role.



5004
5005
5006
# File 'lib/models/porcelain.rb', line 5004

def name
  @name
end

#tagsObject

Tags is a map of key, value pairs.



5008
5009
5010
# File 'lib/models/porcelain.rb', line 5008

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



5030
5031
5032
5033
5034
5035
5036
# File 'lib/models/porcelain.rb', line 5030

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