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.
-
#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.
-
#messages ⇒ Array<Arkaan::Chatrooms::Messages>
All the messages ever sent by the user.
-
#notifications ⇒ Array<Arkaan::Notification>
The notifications linked to this user.
-
#password ⇒ String
writeonly
Password, in clear, of the user if you just changed it.
-
#password_confirmation ⇒ String
writeonly
The confirmation of the password, that matches the password itself.
-
#password_digest ⇒ String
readonly
The password of the user, encrypted with the Blowfish algorithm.
-
#permissions ⇒ Array<Arkaan::Files::Permission>
The file access permissions granted to this account.
-
#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 current name identifying the user on the GUI.
Instance Method Summary collapse
-
#read_notifications ⇒ Array<Arkaan::Notification>
The notifications already read byt the user.
-
#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.
46 |
# File 'lib/arkaan/account.rb', line 46 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.
50 |
# File 'lib/arkaan/account.rb', line 50 has_many :authorizations, class_name: 'Arkaan::OAuth::Authorization', inverse_of: :account |
#email ⇒ String
Returns the email address of the user, useful to contact them.
26 |
# File 'lib/arkaan/account.rb', line 26 field :email, type: String |
#firstname ⇒ String
Returns the first name of the user.
23 |
# File 'lib/arkaan/account.rb', line 23 field :firstname, type: String, default: '' |
#gender ⇒ Symbol
Returns the way you prefer the application to gender you.
32 |
# File 'lib/arkaan/account.rb', line 32 enum_field :gender, %i[female male neutral], default: :neutral |
#groups ⇒ Array<Arkaan::Permissions::Group>
Returns the groups giving their corresponding rights to the current account.
42 |
# File 'lib/arkaan/account.rb', line 42 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.
59 |
# File 'lib/arkaan/account.rb', line 59 has_many :invitations, class_name: 'Arkaan::Campaigns::Invitation', inverse_of: :account |
#language ⇒ Symbol
Returns the language preferred by this user.
29 |
# File 'lib/arkaan/account.rb', line 29 enum_field :language, %i[en_GB fr_FR], default: :fr_FR |
#lastname ⇒ String
Returns the last name (family name) of the user.
20 |
# File 'lib/arkaan/account.rb', line 20 field :lastname, type: String, default: '' |
#messages ⇒ Array<Arkaan::Chatrooms::Messages>
Returns all the messages ever sent by the user.
68 |
# File 'lib/arkaan/account.rb', line 68 has_many :messages, class_name: 'Arkaan::Chatrooms::Message', inverse_of: :account |
#notifications ⇒ Array<Arkaan::Notification>
Returns the notifications linked to this user.
74 |
# File 'lib/arkaan/account.rb', line 74 :notifications, class_name: 'Arkaan::Notification', inverse_of: :account |
#password=(value) ⇒ String (writeonly)
Returns password, in clear, of the user if you just changed it.
38 |
# File 'lib/arkaan/account.rb', line 38 has_secure_password validations: false |
#password_confirmation=(value) ⇒ String (writeonly)
Returns the confirmation of the password, that matches the password itself.
38 |
# File 'lib/arkaan/account.rb', line 38 has_secure_password validations: false |
#password_digest ⇒ String (readonly)
Returns the password of the user, encrypted with the Blowfish algorithm.
17 |
# File 'lib/arkaan/account.rb', line 17 field :password_digest, type: String |
#permissions ⇒ Array<Arkaan::Files::Permission>
Returns the file access permissions granted to this account.
65 |
# File 'lib/arkaan/account.rb', line 65 has_many :permissions, class_name: 'Arkaan::Files::Permission', inverse_of: :account |
#services ⇒ Array<Arkaan::Monitoring::Service>
Returns the services created by this user.
53 |
# File 'lib/arkaan/account.rb', line 53 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.
56 |
# File 'lib/arkaan/account.rb', line 56 has_many :sessions, class_name: 'Arkaan::Authentication::Session', inverse_of: :account |
#username ⇒ String
Returns the current name identifying the user on the GUI.
14 |
# File 'lib/arkaan/account.rb', line 14 field :username, type: String |
Instance Method Details
#read_notifications ⇒ Array<Arkaan::Notification>
Returns the notifications already read byt the user.
82 83 84 |
# File 'lib/arkaan/account.rb', line 82 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.
77 78 79 |
# File 'lib/arkaan/account.rb', line 77 def unread_notifications notifications.where(read: false) end |