Class: Virtuaservices::Account

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::SecurePassword, Mongoid::Document, Mongoid::Timestamps, Concerns::Enumerable
Defined in:
lib/virtuaservices/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 Attribute Details

#applicationsArray<Virtuaservices::OAuth::Application] the applications this user has created and owns.

Returns Array<Virtuaservices::OAuth::Application] the applications this user has created and owns.

Returns:



44
# File 'lib/virtuaservices/account.rb', line 44

has_many :applications, class_name: 'Virtuaservices::OAuth::Application', inverse_of: :creator

#emailString

Returns the email address of the user, useful to contact them ; it must be given, unique, and have an email format.

Returns:

  • (String)

    the email address of the user, useful to contact them ; it must be given, unique, and have an email format.



24
# File 'lib/virtuaservices/account.rb', line 24

field :email, type: String

#firstnameString

Returns the first name of the user.

Returns:

  • (String)

    the first name of the user.



21
# File 'lib/virtuaservices/account.rb', line 21

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

#genderSymbol

Returns the way you prefer the application to gender you.

Returns:

  • (Symbol)

    the way you prefer the application to gender you.



30
# File 'lib/virtuaservices/account.rb', line 30

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

#groupsArray<Virtuaservices::Permissions::Group>

Returns the groups giving their corresponding rights to the current account.

Returns:



40
# File 'lib/virtuaservices/account.rb', line 40

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

#languageSymbol

Returns the language preferred by this user.

Returns:

  • (Symbol)

    the language preferred by this user.



27
# File 'lib/virtuaservices/account.rb', line 27

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

#lastnameString

Returns the last name (family name) of the user.

Returns:

  • (String)

    the last name (family name) of the user.



18
# File 'lib/virtuaservices/account.rb', line 18

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

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

Returns:

  • (String)

    password, in clear, of the user ; do not attempt to get the value, just set it when changing the password.



36
# File 'lib/virtuaservices/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.

Returns:

  • (String)

    the confirmation of the password, do not get, just set it ; it must be the same as the password.



36
# File 'lib/virtuaservices/account.rb', line 36

has_secure_password validations: false

#password_digestString (readonly)

Returns the password of the user, encrypted with the Blowfish algorithm.

Returns:

  • (String)

    the password of the user, encrypted with the Blowfish algorithm.



15
# File 'lib/virtuaservices/account.rb', line 15

field :password_digest, type: String

#servicesArray<Virtuaservices::Monitoring::Service>

Returns the services created by this user.

Returns:



47
# File 'lib/virtuaservices/account.rb', line 47

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

#sessionsArray<Virtuaservices::Authentication::Session>

Returns the sessions on which this account is, or has been logged in.

Returns:



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

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

#usernameString

Returns the nickname the user chose at subscription, must be given, unique, and 6 or more characters long.

Returns:

  • (String)

    the nickname the user chose at subscription, must be given, unique, and 6 or more characters long.



12
# File 'lib/virtuaservices/account.rb', line 12

field :username, type: String

#websocketsArray<Virtuaservices::Monitoring::Websocket>

Returns the websockets created by the owner of this account.

Returns:



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

has_many :websockets, class_name: 'Virtuaservices::Monitoring::Websocket', inverse_of: :creator