Module: Shibboleth::Rails::ModelAdditions::InstanceMethods

Defined in:
lib/shibboleth-rails/user_model_additions.rb

Instance Method Summary collapse

Instance Method Details

#update_usage_stats(request, args = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/shibboleth-rails/user_model_additions.rb', line 29

def update_usage_stats(request, args = {})
  if args[:login]
    if self.respond_to?(:login_count)
      self. ||= 0
      self.  += 1
    end

    if self.respond_to?(:current_login_at)
      self. = self. if self.respond_to?(:last_login_at)
      self. = Time.now
    end

    if self.respond_to?(:current_login_ip)
      self. = self. if self.respond_to?(:last_login_ip)
      self. = request.remote_ip
    end

    self.(request, args) if self.respond_to?(:login_callback)

    save(:validate => false)

  end

  self.request_callback(request, args) if self.respond_to?(:request_callback)
end