Class: SDM::User

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

Overview

A User can connect to resources they are granted directly, or granted via roles.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email: nil, external_id: nil, first_name: nil, id: nil, last_name: nil, managed_by: nil, permission_level: nil, suspended: nil, tags: nil) ⇒ User

Returns a new instance of User.



11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
# File 'lib/models/porcelain.rb', line 11129

def initialize(
  email: nil,
  external_id: nil,
  first_name: nil,
  id: nil,
  last_name: nil,
  managed_by: nil,
  permission_level: nil,
  suspended: nil,
  tags: nil
)
  @email = email == nil ? "" : email
  @external_id = external_id == nil ? "" : external_id
  @first_name = first_name == nil ? "" : first_name
  @id = id == nil ? "" : id
  @last_name = last_name == nil ? "" : last_name
  @managed_by = managed_by == nil ? "" : managed_by
  @permission_level = permission_level == nil ? "" : permission_level
  @suspended = suspended == nil ? false : suspended
  @tags = tags == nil ? SDM::_porcelain_zero_value_tags() : tags
end

Instance Attribute Details

#emailObject

The User's email address. Must be unique.



11111
11112
11113
# File 'lib/models/porcelain.rb', line 11111

def email
  @email
end

#external_idObject

External ID is an alternative unique ID this user is represented by within an external service.



11113
11114
11115
# File 'lib/models/porcelain.rb', line 11113

def external_id
  @external_id
end

#first_nameObject

The User's first name.



11115
11116
11117
# File 'lib/models/porcelain.rb', line 11115

def first_name
  @first_name
end

#idObject

Unique identifier of the User.



11117
11118
11119
# File 'lib/models/porcelain.rb', line 11117

def id
  @id
end

#last_nameObject

The User's last name.



11119
11120
11121
# File 'lib/models/porcelain.rb', line 11119

def last_name
  @last_name
end

#managed_byObject

Managed By is a read only field for what service manages this user, e.g. StrongDM, Okta, Azure.



11121
11122
11123
# File 'lib/models/porcelain.rb', line 11121

def managed_by
  @managed_by
end

#permission_levelObject

PermissionLevel is the user's permission level e.g. admin, DBA, user.



11123
11124
11125
# File 'lib/models/porcelain.rb', line 11123

def permission_level
  @permission_level
end

#suspendedObject

Suspended is a read only field for the User's suspended state.



11125
11126
11127
# File 'lib/models/porcelain.rb', line 11125

def suspended
  @suspended
end

#tagsObject

Tags is a map of key, value pairs.



11127
11128
11129
# File 'lib/models/porcelain.rb', line 11127

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



11151
11152
11153
11154
11155
11156
11157
# File 'lib/models/porcelain.rb', line 11151

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