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.
-
#groups ⇒ Array<Core::Models::Permissions::Group>
The groups giving their corresponding rights to the current account.
-
#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.
-
#services ⇒ Array<Core::Models::Monitoring::Service>
The services created by this user.
-
#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.
45 |
# File 'lib/core/models/account.rb', line 45 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.
48 |
# File 'lib/core/models/account.rb', line 48 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.
25 |
# File 'lib/core/models/account.rb', line 25 field :email, type: String |
#firstname ⇒ String
Returns the first name of the user.
22 |
# File 'lib/core/models/account.rb', line 22 field :firstname, type: String, default: '' |
#gender ⇒ Symbol
Returns the way you prefer the application to gender you.
31 |
# File 'lib/core/models/account.rb', line 31 enum_field :gender, [:female, :male, :neutral], default: :neutral |
#groups ⇒ Array<Core::Models::Permissions::Group>
Returns the groups giving their corresponding rights to the current account.
41 |
# File 'lib/core/models/account.rb', line 41 has_and_belongs_to_many :groups, class_name: 'Core::Models::Permissions::Group', inverse_of: :accounts |
#invitations ⇒ Array<Core::Models::Campaigns::Invitation>
Returns the invitations you've issued yourself to other players.
57 |
# File 'lib/core/models/account.rb', line 57 has_many :invitations, class_name: 'Core::Models::Campaigns::Invitation', inverse_of: :account |
#language ⇒ Symbol
Returns the language preferred by this user.
28 |
# File 'lib/core/models/account.rb', line 28 enum_field :language, [:en_GB, :fr_FR], default: :fr_FR |
#lastname ⇒ String
Returns the last name (family name) of the user.
19 |
# File 'lib/core/models/account.rb', line 19 field :lastname, type: String, default: '' |
#messages ⇒ Array<Core::Models::Chatrooms::Messages>
Returns all the messages ever sent by the user.
66 |
# File 'lib/core/models/account.rb', line 66 has_many :messages, class_name: 'Core::Models::Chatrooms::Message', inverse_of: :account |
#notifications ⇒ Array<Core::Models::Notification>
Returns the notifications linked to this user.
72 |
# File 'lib/core/models/account.rb', line 72 :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.
37 |
# File 'lib/core/models/account.rb', line 37 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.
37 |
# File 'lib/core/models/account.rb', line 37 has_secure_password validations: false |
#password_digest ⇒ String (readonly)
Returns the password of the user, encrypted with the Blowfish algorithm.
16 |
# File 'lib/core/models/account.rb', line 16 field :password_digest, type: String |
#permissions ⇒ Array<Core::Models::Files::Permission>
Returns the file access permissions granted to this account.
63 |
# File 'lib/core/models/account.rb', line 63 has_many :permissions, class_name: 'Core::Models::Files::Permission', inverse_of: :account |
#services ⇒ Array<Core::Models::Monitoring::Service>
Returns the services created by this user.
51 |
# File 'lib/core/models/account.rb', line 51 has_many :services, class_name: 'Core::Models::Monitoring::Service', inverse_of: :creator |
#sessions ⇒ Array<Core::Models::Authentication::Session>
Returns the sessions on which this account is, or has been logged in.
54 |
# File 'lib/core/models/account.rb', line 54 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.
13 |
# File 'lib/core/models/account.rb', line 13 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.
80 81 82 |
# File 'lib/core/models/account.rb', line 80 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.
75 76 77 |
# File 'lib/core/models/account.rb', line 75 def unread_notifications notifications.where(read: false) end |