Class: Arkaan::Account
- Inherits:
-
Object
- Object
- Arkaan::Account
- Includes:
- ActiveModel::SecurePassword, Concerns::Enumerable, Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/arkaan/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<Arkaan::OAuth::Application] the applications this user has created and owns.
Array<Arkaan::OAuth::Application] the applications this user has created and owns.
-
#authorizations ⇒ Array<Arkaan::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<Arkaan::Permissions::Group>
The groups giving their corresponding rights to the current account.
-
#invitations ⇒ Array<Arkaan::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.
-
#notifications ⇒ Array<Arkaan::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.
-
#phones ⇒ Array<Arkaan::Phone>
The phone numbers given by the user.
-
#services ⇒ Array<Arkaan::Monitoring::Service>
The services created by this user.
-
#sessions ⇒ Array<Arkaan::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.
-
#websockets ⇒ Array<Arkaan::Monitoring::Websocket>
The websockets created by the owner of this account.
Instance Method Summary collapse
-
#read_notifications ⇒ Array<Arkaan::Notification>
The notifications already read, less important to display than the unread ones.
-
#unread_notifications ⇒ Array<Arkaan::Notification>
The unread notifications that should be displayed first for the user.
Instance Attribute Details
#applications ⇒ Array<Arkaan::OAuth::Application] the applications this user has created and owns.
Returns Array<Arkaan::OAuth::Application] the applications this user has created and owns.
44 |
# File 'lib/arkaan/account.rb', line 44 has_many :applications, class_name: 'Arkaan::OAuth::Application', inverse_of: :creator |
#authorizations ⇒ Array<Arkaan::OAuth::Authorization>
Returns the authorization issued by this account to third-party applications to access its data.
47 |
# File 'lib/arkaan/account.rb', line 47 has_many :authorizations, class_name: 'Arkaan::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.
24 |
# File 'lib/arkaan/account.rb', line 24 field :email, type: String |
#firstname ⇒ String
Returns the first name of the user.
21 |
# File 'lib/arkaan/account.rb', line 21 field :firstname, type: String, default: '' |
#gender ⇒ Symbol
Returns the way you prefer the application to gender you.
30 |
# File 'lib/arkaan/account.rb', line 30 enum_field :gender, [:female, :male, :neutral], default: :neutral |
#groups ⇒ Array<Arkaan::Permissions::Group>
Returns the groups giving their corresponding rights to the current account.
40 |
# File 'lib/arkaan/account.rb', line 40 has_and_belongs_to_many :groups, class_name: 'Arkaan::Permissions::Group', inverse_of: :accounts |
#invitations ⇒ Array<Arkaan::Campaigns::Invitation>
Returns the invitations you’ve issued yourself to other players.
56 |
# File 'lib/arkaan/account.rb', line 56 has_many :invitations, class_name: 'Arkaan::Campaigns::Invitation', inverse_of: :account |
#language ⇒ Symbol
Returns the language preferred by this user.
27 |
# File 'lib/arkaan/account.rb', line 27 enum_field :language, [:en_GB, :fr_FR], default: :fr_FR |
#lastname ⇒ String
Returns the last name (family name) of the user.
18 |
# File 'lib/arkaan/account.rb', line 18 field :lastname, type: String, default: '' |
#notifications ⇒ Array<Arkaan::Notification>
Returns the notifications linked to this user.
69 |
# File 'lib/arkaan/account.rb', line 69 :notifications, class_name: 'Arkaan::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.
36 |
# File 'lib/arkaan/account.rb', line 36 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.
36 |
# File 'lib/arkaan/account.rb', line 36 has_secure_password validations: false |
#password_digest ⇒ String (readonly)
Returns the password of the user, encrypted with the Blowfish algorithm.
15 |
# File 'lib/arkaan/account.rb', line 15 field :password_digest, type: String |
#phones ⇒ Array<Arkaan::Phone>
Returns the phone numbers given by the user.
66 |
# File 'lib/arkaan/account.rb', line 66 :phones, class_name: 'Arkaan::Phone', inverse_of: :account |
#services ⇒ Array<Arkaan::Monitoring::Service>
Returns the services created by this user.
50 |
# File 'lib/arkaan/account.rb', line 50 has_many :services, class_name: 'Arkaan::Monitoring::Service', inverse_of: :creator |
#sessions ⇒ Array<Arkaan::Authentication::Session>
Returns the sessions on which this account is, or has been logged in.
53 |
# File 'lib/arkaan/account.rb', line 53 has_many :sessions, class_name: 'Arkaan::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.
12 |
# File 'lib/arkaan/account.rb', line 12 field :username, type: String |
#websockets ⇒ Array<Arkaan::Monitoring::Websocket>
Returns the websockets created by the owner of this account.
62 |
# File 'lib/arkaan/account.rb', line 62 has_many :websockets, class_name: 'Arkaan::Monitoring::Websocket', inverse_of: :creator |
Instance Method Details
#read_notifications ⇒ Array<Arkaan::Notification>
Returns the notifications already read, less important to display than the unread ones.
77 78 79 |
# File 'lib/arkaan/account.rb', line 77 def read_notifications notifications.where(read: true) end |
#unread_notifications ⇒ Array<Arkaan::Notification>
Returns the unread notifications that should be displayed first for the user.
72 73 74 |
# File 'lib/arkaan/account.rb', line 72 def unread_notifications notifications.where(read: false) end |