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, access_rules: nil, composite: nil, tags: nil) ⇒ Role

Returns a new instance of Role.



6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
# File 'lib/models/porcelain.rb', line 6706

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

Instance Attribute Details

#access_rulesObject

AccessRules JSON encoded access rules data.



6700
6701
6702
# File 'lib/models/porcelain.rb', line 6700

def access_rules
  @access_rules
end

#compositeObject

True if the Role is a composite role.



6702
6703
6704
# File 'lib/models/porcelain.rb', line 6702

def composite
  @composite
end

#idObject

Unique identifier of the Role.



6696
6697
6698
# File 'lib/models/porcelain.rb', line 6696

def id
  @id
end

#nameObject

Unique human-readable name of the Role.



6698
6699
6700
# File 'lib/models/porcelain.rb', line 6698

def name
  @name
end

#tagsObject

Tags is a map of key, value pairs.



6704
6705
6706
# File 'lib/models/porcelain.rb', line 6704

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6730
6731
6732
6733
6734
6735
6736
# File 'lib/models/porcelain.rb', line 6730

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