Module: HasHelpers::UserMethods
- Defined in:
- app/models/has_helpers/user_methods.rb
Defined Under Namespace
Modules: InstanceMethods
Constant Summary collapse
- REMOTE_ATTRS =
%w[first_name last_name photo_file_name photo_content_type photo_file_size photo_updated_at]
- PHOTO_OPTIONS =
Including apps' user models can use this to set common settings for user photos.
{ # Always use the hqadmin bucket for user photos bucket: "hqadmin-#{::HasUtils::Env.current_environment}", # TODO: upgrade paperclip to 6 and you can use -> { "#{::HasHelpers::Application::HQADMIN.name}-#{ ::HasUtils::Env.current_environment }" }, }.freeze
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/models/has_helpers/user_methods.rb', line 13 def self.included(base) base.class_eval do attr_accessor :skip_update_master_record # When set to a truthy value this prevents pushing changes to the AdminHQ API on save. attr_accessor :master_record_attributes # Set with the attributes returned from pushing user changes to the AdminHQ API attr_accessor :extra_attributes # Stores information retrieved from hqsso. These can be handled every time cas_extra_attributes= # is called by creating a method called handle_extra_attributes on the class/module that includes this module. def ip_whitelist # The support user does not have an IP whitelist. # Support users can log in from anywhere. return nil if is_support? [*super, *organization.ip_whitelist].presence end serialize :permissions_hash, type: Hash serialize :applications_array, type: Array # Runs within the save transaction. Pushes changes to IAMHQ # Do not run this callback from within IAMHQ after_save :update_master_record, unless: -> { HasHelpers::Application.current_application == ::HasHelpers::Application::HQADMIN || skip_update_master_record } after_commit :save_master_record_attributes, if: :master_record_attributes end base.send(:include, InstanceMethods) end |