Class: Faalis::User

Inherits:
Object
  • Object
show all
Includes:
Concerns::Authorizable, Concerns::User::AuthDefinitions, Concerns::User::Gravatar, Concerns::User::MongoidFields, Concerns::User::Permission, Concerns::User::UserRoles, Mongoid::Document, Mongoid::Timestamps
Defined in:
app/models/faalis/user.rb

Overview

User model for Faalis platform

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Concerns::User::UserRoles

#admin?, #role?, #roles

Methods included from Concerns::User::AuthDefinitions

#admin?, #confirmation_required?, #full_name, included, #name, #password_required?, #update_with_password

Class Method Details

.policy_classObject



72
73
74
# File 'app/models/faalis/user.rb', line 72

def self.policy_class
  Faalis::UserPolicy
end

Instance Method Details

#join_guestsObject

It’s totally obviuse. Join the guest group if no group provided



63
64
65
66
67
68
69
70
# File 'app/models/faalis/user.rb', line 63

def join_guests
  #::Faalis::Group.find_by(role: 'guest')
  if groups.empty?
    guest_group = ::Faalis::Group.find_or_create_by(name: 'Guest',
                                                    role: 'guest')
    self.groups << guest_group
  end
end

#to_sObject



76
77
78
# File 'app/models/faalis/user.rb', line 76

def to_s
  full_name || email
end