Class: Core::Models::Account
- Inherits:
-
Object
- Object
- Core::Models::Account
- Includes:
- ActiveModel::SecurePassword, Concerns::Enumerable, Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/core/models/account.rb
Overview
A user account with all related attributes. It holds credentials and informations about a designated user.
Instance Attribute Summary collapse
-
#applications ⇒ Array<Core::Models::OAuth::Application] the applications this user has created and owns.
Array<Core::Models::OAuth::Application] the applications this user has created and owns.
-
#authorizations ⇒ Array<Core::Models::OAuth::Authorization>
The authorization issued by this account to third-party applications to access its data.
-
#email ⇒ String
The email address of the user, useful to contact them ; it must be given, unique, and have an email format.
-
#firstname ⇒ String
The first name of the user.
-
#gender ⇒ Symbol
The way you prefer the application to gender you.
-
#invitations ⇒ Array<Core::Models::Campaigns::Invitation>
The invitations you’ve issued yourself to other players.
-
#language ⇒ Symbol
The language preferred by this user.
-
#lastname ⇒ String
The last name (family name) of the user.
-
#messages ⇒ Array<Core::Models::Chatrooms::Messages>
All the messages ever sent by the user.
-
#notifications ⇒ Array<Core::Models::Notification>
The notifications linked to this user.
-
#password ⇒ String
writeonly
Password, in clear, of the user ; do not attempt to get the value, just set it when changing the password.
-
#password_confirmation ⇒ String
writeonly
The confirmation of the password, do not get, just set it ; it must be the same as the password.
-
#password_digest ⇒ String
readonly
The password of the user, encrypted with the Blowfish algorithm.
-
#permissions ⇒ Array<Core::Models::Files::Permission>
The file access permissions granted to this account.
-
#sessions ⇒ Array<Core::Models::Authentication::Session>
The sessions on which this account is, or has been logged in.
-
#username ⇒ String
The nickname the user chose at subscription, must be given, unique, and 6 or more characters long.
Instance Method Summary collapse
-
#read_notifications ⇒ Array<Core::Models::Notification>
The notifications already read, less important to display than the unread ones.
-
#unread_notifications ⇒ Array<Core::Models::Notification>
The unread notifications that should be displayed first for the user.
Instance Attribute Details
#applications ⇒ Array<Core::Models::OAuth::Application] the applications this user has created and owns.
Returns Array<Core::Models::OAuth::Application] the applications this user has created and owns.
43 |
# File 'lib/core/models/account.rb', line 43 has_many :applications, class_name: 'Core::Models::OAuth::Application', inverse_of: :creator |
#authorizations ⇒ Array<Core::Models::OAuth::Authorization>
Returns the authorization issued by this account to third-party applications to access its data.
46 |
# File 'lib/core/models/account.rb', line 46 has_many :authorizations, class_name: 'Core::Models::OAuth::Authorization', inverse_of: :account |
#email ⇒ String
Returns the email address of the user, useful to contact them ; it must be given, unique, and have an email format.
27 |
# File 'lib/core/models/account.rb', line 27 field :email, type: String |
#firstname ⇒ String
Returns the first name of the user.
24 |
# File 'lib/core/models/account.rb', line 24 field :firstname, type: String, default: '' |
#gender ⇒ Symbol
Returns the way you prefer the application to gender you.
33 |
# File 'lib/core/models/account.rb', line 33 enum_field :gender, [:female, :male, :neutral], default: :neutral |
#invitations ⇒ Array<Core::Models::Campaigns::Invitation>
Returns the invitations you’ve issued yourself to other players.
52 |
# File 'lib/core/models/account.rb', line 52 has_many :invitations, class_name: 'Core::Models::Campaigns::Invitation', inverse_of: :account |
#language ⇒ Symbol
Returns the language preferred by this user.
30 |
# File 'lib/core/models/account.rb', line 30 enum_field :language, [:en_GB, :fr_FR], default: :fr_FR |
#lastname ⇒ String
Returns the last name (family name) of the user.
21 |
# File 'lib/core/models/account.rb', line 21 field :lastname, type: String, default: '' |
#messages ⇒ Array<Core::Models::Chatrooms::Messages>
Returns all the messages ever sent by the user.
61 |
# File 'lib/core/models/account.rb', line 61 has_many :messages, class_name: 'Core::Models::Chatrooms::Message', inverse_of: :account |
#notifications ⇒ Array<Core::Models::Notification>
Returns the notifications linked to this user.
65 |
# File 'lib/core/models/account.rb', line 65 :notifications, class_name: 'Core::Models::Notification', inverse_of: :account |
#password=(value) ⇒ String (writeonly)
Returns password, in clear, of the user ; do not attempt to get the value, just set it when changing the password.
39 |
# File 'lib/core/models/account.rb', line 39 has_secure_password validations: false |
#password_confirmation=(value) ⇒ String (writeonly)
Returns the confirmation of the password, do not get, just set it ; it must be the same as the password.
39 |
# File 'lib/core/models/account.rb', line 39 has_secure_password validations: false |
#password_digest ⇒ String (readonly)
Returns the password of the user, encrypted with the Blowfish algorithm.
18 |
# File 'lib/core/models/account.rb', line 18 field :password_digest, type: String |
#permissions ⇒ Array<Core::Models::Files::Permission>
Returns the file access permissions granted to this account.
58 |
# File 'lib/core/models/account.rb', line 58 has_many :permissions, class_name: 'Core::Models::Files::Permission', inverse_of: :account |
#sessions ⇒ Array<Core::Models::Authentication::Session>
Returns the sessions on which this account is, or has been logged in.
49 |
# File 'lib/core/models/account.rb', line 49 has_many :sessions, class_name: 'Core::Models::Authentication::Session', inverse_of: :account |
#username ⇒ String
Returns the nickname the user chose at subscription, must be given, unique, and 6 or more characters long.
15 |
# File 'lib/core/models/account.rb', line 15 field :username, type: String |
Instance Method Details
#read_notifications ⇒ Array<Core::Models::Notification>
Returns the notifications already read, less important to display than the unread ones.
73 74 75 |
# File 'lib/core/models/account.rb', line 73 def read_notifications notifications.where(read: true) end |
#unread_notifications ⇒ Array<Core::Models::Notification>
Returns the unread notifications that should be displayed first for the user.
68 69 70 |
# File 'lib/core/models/account.rb', line 68 def unread_notifications notifications.where(read: false) end |