class AuthLh::User

Attributes

attendance_mode[RW]
email[RW]
enabled[RW]
extension_number[RW]
external_apps[RW]
fingerprint_from[RW]
fingerprint_to[RW]
first_name[RW]
has_remote_desktop[RW]
jabber[RW]
last_name[RW]
local_app_shop_codes[RW]
login[RW]
password_expired[RW]
roles[RW]
shop_code[RW]
shop_id[RW]
shop_name[RW]

Public Class Methods

new(attributes={}) click to toggle source
# File lib/auth_lh/user.rb, line 9
def initialize(attributes={})
  attributes.each do |k,v|
    if k.to_s == 'external_apps'
      self.external_apps = v.map { |x| ExternalApp.new(x) }
    elsif k.to_s == 'roles'
      self.roles = v.map { |x| Role.new(x) }
    else
      self.send("#{k}=", v)
    end
  end
end

Public Instance Methods

has_all_roles?(r_ids) click to toggle source
# File lib/auth_lh/user.rb, line 39
def has_all_roles?(r_ids)
  r_ids.all? { |r_id|
    role_ids.include?(r_id.to_i)
  }
end
has_role?(role_id) click to toggle source
# File lib/auth_lh/user.rb, line 29
def has_role?(role_id)
  role_ids.include?(role_id.to_i)
end
has_some_role?(r_ids) click to toggle source
# File lib/auth_lh/user.rb, line 33
def has_some_role?(r_ids)
  r_ids.any? { |r_id|
    role_ids.include?(r_id.to_i)
  }
end
name() click to toggle source
# File lib/auth_lh/user.rb, line 21
def name
  "#{first_name} #{last_name}"
end
role_ids() click to toggle source
# File lib/auth_lh/user.rb, line 25
def role_ids
  roles.map(&:id)
end