Class: User
- Inherits:
-
Object
- Object
- User
- Includes:
- App47EmailSendable, App47Logger, Mongoid::Document, Mongoid::Timestamps, Searchable
- Defined in:
- lib/models/user.rb
Overview
A user in the system is someone who has access to the enterprise app store
Direct Known Subclasses
Instance Method Summary collapse
-
#allowed_app_set ⇒ Object
Return the unique set of application ids for this given user.
-
#find_device_by(device_id) ⇒ Object
Find a user device by safely trying a number of approaches 1.
Methods included from Searchable
Methods included from App47Logger
log_debug, #log_debug, log_error, #log_error, log_exception, log_message, #log_message, #log_warn, log_warn
Methods included from App47EmailSendable
Instance Method Details
#allowed_app_set ⇒ Object
Return the unique set of application ids for this given user
32 33 34 |
# File 'lib/models/user.rb', line 32 def allowed_app_set .collect(&:app) + account.apps.distinct_all_users end |
#find_device_by(device_id) ⇒ Object
Find a user device by safely trying a number of approaches
-
By ID
-
By unique identifier
-
By app47 identifier
-
By token
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/models/user.rb', line 43 def find_device_by(device_id) raise 'Invalid ID' if device_id.blank? devices.where(_id: device_id).first || devices.where(unique_identifier: device_id).first || devices.where(app47_identifier: device_id).first || devices.where(token: device_id).first rescue StandardError nil end |