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



5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
# File 'lib/models/porcelain.rb', line 5415

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

Instance Attribute Details

#access_rulesObject

AccessRules JSON encoded access rules data.



5405
5406
5407
# File 'lib/models/porcelain.rb', line 5405

def access_rules
  @access_rules
end

#compositeObject

True if the Role is a composite role.



5407
5408
5409
# File 'lib/models/porcelain.rb', line 5407

def composite
  @composite
end

#idObject

Unique identifier of the Role.



5409
5410
5411
# File 'lib/models/porcelain.rb', line 5409

def id
  @id
end

#nameObject

Unique human-readable name of the Role.



5411
5412
5413
# File 'lib/models/porcelain.rb', line 5411

def name
  @name
end

#tagsObject

Tags is a map of key, value pairs.



5413
5414
5415
# File 'lib/models/porcelain.rb', line 5413

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



5439
5440
5441
5442
5443
5444
5445
# File 'lib/models/porcelain.rb', line 5439

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