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.



5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
# File 'lib/models/porcelain.rb', line 5367

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.



5363
5364
5365
# File 'lib/models/porcelain.rb', line 5363

def composite
  @composite
end

#idObject

Unique identifier of the Role.



5359
5360
5361
# File 'lib/models/porcelain.rb', line 5359

def id
  @id
end

#nameObject

Unique human-readable name of the Role.



5361
5362
5363
# File 'lib/models/porcelain.rb', line 5361

def name
  @name
end

#tagsObject

Tags is a map of key, value pairs.



5365
5366
5367
# File 'lib/models/porcelain.rb', line 5365

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



5387
5388
5389
5390
5391
5392
5393
# File 'lib/models/porcelain.rb', line 5387

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