Class: SDM::Role

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

Overview

A Role is a collection of permissions, 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) ⇒ Role

Returns a new instance of Role.



4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
# File 'lib/models/porcelain.rb', line 4407

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

Instance Attribute Details

#compositeObject

True if the Role is a composite role.



4405
4406
4407
# File 'lib/models/porcelain.rb', line 4405

def composite
  @composite
end

#idObject

Unique identifier of the Role.



4401
4402
4403
# File 'lib/models/porcelain.rb', line 4401

def id
  @id
end

#nameObject

Unique human-readable name of the Role.



4403
4404
4405
# File 'lib/models/porcelain.rb', line 4403

def name
  @name
end

Instance Method Details

#to_json(options = {}) ⇒ Object



4423
4424
4425
4426
4427
4428
4429
# File 'lib/models/porcelain.rb', line 4423

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