Class: Arkaan::Account

Inherits:
Object
  • Object
show all
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.

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#applicationsArray<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

#authorizationsArray<Arkaan::OAuth::Authorization>



50
# File 'lib/arkaan/account.rb', line 50

has_many :authorizations, class_name: 'Arkaan::OAuth::Authorization', inverse_of: :account

#emailString



26
# File 'lib/arkaan/account.rb', line 26

field :email, type: String

#firstnameString



23
# File 'lib/arkaan/account.rb', line 23

field :firstname, type: String, default: ''

#genderSymbol



32
# File 'lib/arkaan/account.rb', line 32

enum_field :gender, %i[female male neutral], default: :neutral

#groupsArray<Arkaan::Permissions::Group>



42
# File 'lib/arkaan/account.rb', line 42

has_and_belongs_to_many :groups, class_name: 'Arkaan::Permissions::Group', inverse_of: :accounts

#invitationsArray<Arkaan::Campaigns::Invitation>



59
# File 'lib/arkaan/account.rb', line 59

has_many :invitations, class_name: 'Arkaan::Campaigns::Invitation', inverse_of: :account

#languageSymbol



29
# File 'lib/arkaan/account.rb', line 29

enum_field :language, %i[en_GB fr_FR], default: :fr_FR

#lastnameString



20
# File 'lib/arkaan/account.rb', line 20

field :lastname, type: String, default: ''

#messagesArray<Arkaan::Chatrooms::Messages>



68
# File 'lib/arkaan/account.rb', line 68

has_many :messages, class_name: 'Arkaan::Chatrooms::Message', inverse_of: :account

#notificationsArray<Arkaan::Notification>



74
# File 'lib/arkaan/account.rb', line 74

embeds_many :notifications, class_name: 'Arkaan::Notification', inverse_of: :account

#password=(value) ⇒ String (writeonly)



38
# File 'lib/arkaan/account.rb', line 38

has_secure_password validations: false

#password_confirmation=(value) ⇒ String (writeonly)



38
# File 'lib/arkaan/account.rb', line 38

has_secure_password validations: false

#password_digestString (readonly)



17
# File 'lib/arkaan/account.rb', line 17

field :password_digest, type: String

#permissionsArray<Arkaan::Files::Permission>



65
# File 'lib/arkaan/account.rb', line 65

has_many :permissions, class_name: 'Arkaan::Files::Permission', inverse_of: :account

#servicesArray<Arkaan::Monitoring::Service>



53
# File 'lib/arkaan/account.rb', line 53

has_many :services, class_name: 'Arkaan::Monitoring::Service', inverse_of: :creator

#sessionsArray<Arkaan::Authentication::Session>



56
# File 'lib/arkaan/account.rb', line 56

has_many :sessions, class_name: 'Arkaan::Authentication::Session', inverse_of: :account

#usernameString



14
# File 'lib/arkaan/account.rb', line 14

field :username, type: String

Instance Method Details

#read_notificationsArray<Arkaan::Notification>



82
83
84
# File 'lib/arkaan/account.rb', line 82

def read_notifications
  notifications.where(read: true)
end

#unread_notificationsArray<Arkaan::Notification>



77
78
79
# File 'lib/arkaan/account.rb', line 77

def unread_notifications
  notifications.where(read: false)
end