Class: Ronin::DB::UserName
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Ronin::DB::UserName
- Includes:
- Model, Model::HasUniqueName, Model::Importable
- Defined in:
- lib/ronin/db/user_name.rb
Overview
Represents a user name and their associated credentials or email addresses.
Instance Attribute Summary collapse
-
#created_at ⇒ Time
readonly
Tracks when the user-name was created.
-
#credentials ⇒ Array<Credential>
Any credentials belonging to the user.
-
#email_addresses ⇒ Array<EmailAddress>
The email addresses of the user.
-
#id ⇒ Integer
The primary key of the user name.
-
#notes ⇒ Array<Note>
The associated notes.
-
#passwords ⇒ Array<Password>
Any passwords used with the user name.
-
#service_credentials ⇒ Array<ServiceCredential>
The service credentials that use the user name.
-
#web_credentials ⇒ Array<WebCredential>
Any web credentials that use the user name.
Attributes included from Model::HasUniqueName
Class Method Summary collapse
-
.import(name) ⇒ UserName
Imports a user name.
-
.lookup(name) ⇒ UserName?
Looks up the user name.
-
.with_password(password) ⇒ Array<UserName>
Queries all user names that are associated with the password.
Methods included from Model::HasUniqueName
Methods included from Model::Importable
Methods included from Model
Instance Attribute Details
#created_at ⇒ Time (readonly)
Tracks when the user-name was created.
51 |
# File 'lib/ronin/db/user_name.rb', line 51 attribute :created_at, :datetime |
#credentials ⇒ Array<Credential>
Any credentials belonging to the user.
57 |
# File 'lib/ronin/db/user_name.rb', line 57 has_many :credentials, dependent: :destroy |
#email_addresses ⇒ Array<EmailAddress>
The email addresses of the user.
87 |
# File 'lib/ronin/db/user_name.rb', line 87 has_many :email_addresses, dependent: :destroy |
#id ⇒ Integer
The primary key of the user name.
45 |
# File 'lib/ronin/db/user_name.rb', line 45 attribute :id, :integer |
#notes ⇒ Array<Note>
The associated notes.
95 |
# File 'lib/ronin/db/user_name.rb', line 95 has_many :notes, dependent: :destroy |
#passwords ⇒ Array<Password>
Any passwords used with the user name.
81 |
# File 'lib/ronin/db/user_name.rb', line 81 has_many :passwords, through: :credentials |
#service_credentials ⇒ Array<ServiceCredential>
The service credentials that use the user name.
65 |
# File 'lib/ronin/db/user_name.rb', line 65 has_many :service_credentials, through: :credentials |
#web_credentials ⇒ Array<WebCredential>
Any web credentials that use the user name.
73 |
# File 'lib/ronin/db/user_name.rb', line 73 has_many :web_credentials, through: :credentials |
Class Method Details
.import(name) ⇒ UserName
Imports a user name.
142 143 144 |
# File 'lib/ronin/db/user_name.rb', line 142 def self.import(name) create(name: name) end |
.lookup(name) ⇒ UserName?
Looks up the user name.
129 130 131 |
# File 'lib/ronin/db/user_name.rb', line 129 def self.lookup(name) find_by(name: name) end |
.with_password(password) ⇒ Array<UserName>
Queries all user names that are associated with the password.
110 111 112 113 114 115 116 117 118 |
# File 'lib/ronin/db/user_name.rb', line 110 def self.with_password(password) joins(credentials: :password).where( credentials: { ronin_passwords: { plain_text: password } } ) end |