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

Returns a new instance of Role.



6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
# File 'lib/models/porcelain.rb', line 6181

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.



6171
6172
6173
# File 'lib/models/porcelain.rb', line 6171

def access_rules
  @access_rules
end

#compositeObject

True if the Role is a composite role.



6173
6174
6175
# File 'lib/models/porcelain.rb', line 6173

def composite
  @composite
end

#idObject

Unique identifier of the Role.



6175
6176
6177
# File 'lib/models/porcelain.rb', line 6175

def id
  @id
end

#nameObject

Unique human-readable name of the Role.



6177
6178
6179
# File 'lib/models/porcelain.rb', line 6177

def name
  @name
end

#tagsObject

Tags is a map of key, value pairs.



6179
6180
6181
# File 'lib/models/porcelain.rb', line 6179

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6205
6206
6207
6208
6209
6210
6211
# File 'lib/models/porcelain.rb', line 6205

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