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, password: nil, permission_level: nil, suspended: nil, tags: nil) ⇒ User

Returns a new instance of User.



12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
# File 'lib/models/porcelain.rb', line 12815

def initialize(
  email: nil,
  external_id: nil,
  first_name: nil,
  id: nil,
  last_name: nil,
  managed_by: nil,
  password: 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
  @password = password == nil ? "" : password
  @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.



12794
12795
12796
# File 'lib/models/porcelain.rb', line 12794

def email
  @email
end

#external_idObject

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



12796
12797
12798
# File 'lib/models/porcelain.rb', line 12796

def external_id
  @external_id
end

#first_nameObject

The User's first name.



12798
12799
12800
# File 'lib/models/porcelain.rb', line 12798

def first_name
  @first_name
end

#idObject

Unique identifier of the User.



12800
12801
12802
# File 'lib/models/porcelain.rb', line 12800

def id
  @id
end

#last_nameObject

The User's last name.



12802
12803
12804
# File 'lib/models/porcelain.rb', line 12802

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.



12804
12805
12806
# File 'lib/models/porcelain.rb', line 12804

def managed_by
  @managed_by
end

#passwordObject

Password is a write-only field that can be used to set the user's password. Currently only supported for update.



12807
12808
12809
# File 'lib/models/porcelain.rb', line 12807

def password
  @password
end

#permission_levelObject

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



12809
12810
12811
# File 'lib/models/porcelain.rb', line 12809

def permission_level
  @permission_level
end

#suspendedObject

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



12811
12812
12813
# File 'lib/models/porcelain.rb', line 12811

def suspended
  @suspended
end

#tagsObject

Tags is a map of key, value pairs.



12813
12814
12815
# File 'lib/models/porcelain.rb', line 12813

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



12839
12840
12841
12842
12843
12844
12845
# File 'lib/models/porcelain.rb', line 12839

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