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

Returns a new instance of Role.



4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
# File 'lib/models/porcelain.rb', line 4977

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.



4973
4974
4975
# File 'lib/models/porcelain.rb', line 4973

def composite
  @composite
end

#idObject

Unique identifier of the Role.



4969
4970
4971
# File 'lib/models/porcelain.rb', line 4969

def id
  @id
end

#nameObject

Unique human-readable name of the Role.



4971
4972
4973
# File 'lib/models/porcelain.rb', line 4971

def name
  @name
end

#tagsObject

Tags is a map of key, value pairs.



4975
4976
4977
# File 'lib/models/porcelain.rb', line 4975

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



4997
4998
4999
5000
5001
5002
5003
# File 'lib/models/porcelain.rb', line 4997

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