module AuthClient::User

Public Instance Methods

activity_notify() click to toggle source
# File lib/auth_client/user.rb, line 27
def activity_notify
  check_app_name

  RedisUserConnector.set id, "#{app_name}_last_activity", Time.zone.now.to_i
end
after_signed_in() click to toggle source
# File lib/auth_client/user.rb, line 47
def after_signed_in
  info_notify
end
app_name() click to toggle source
# File lib/auth_client/user.rb, line 20
def app_name
end
check_app_name() click to toggle source
# File lib/auth_client/user.rb, line 23
def check_app_name
  raise 'User#app_name should not be blank' if app_name.blank?
end
fullname() click to toggle source
# File lib/auth_client/user.rb, line 16
def fullname
  to_s
end
info_hash() click to toggle source
# File lib/auth_client/user.rb, line 39
def info_hash
  { :permissions => permissions_info, :url => "https://#{app_name}.tusur.ru/" }
end
info_notify() click to toggle source
# File lib/auth_client/user.rb, line 33
def info_notify
  check_app_name

  RedisUserConnector.set id, "#{app_name}_info", info_hash.to_json
end
last_activity_at() click to toggle source
# File lib/auth_client/user.rb, line 51
def last_activity_at
  return nil if app_name.blank?

  seconds = instance_variable_get("@#{app_name}_last_activity").to_i

  Time.at(seconds)
end
permissions_info() click to toggle source
# File lib/auth_client/user.rb, line 43
def permissions_info
  permissions.map { |p| { :role => p.role, :info => p.context.try(:to_s) }}
end
to_s() click to toggle source
# File lib/auth_client/user.rb, line 12
def to_s
  [surname, name, patronymic].compact.join(' ')
end