Sha256: 60f218d5d8e4659a086f31ce047bf9857105bd67ed44d5177364988644d491ba
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
module AuthLh class UserExtended attr_accessor :email, :jabber, :login, :password_digest, :password_expired, :enabled, :shop_code, :shop_id, :allow_remote_access, :session_timeout, :only_working_time, :allow_multiple_sessions, :working_time, :has_remote_desktop, :fingerprint_from, :fingerprint_to, :first_name, :last_name, :attendance_mode, :testing_user, :disable_time, :password_remember_enabled, :external_apps, :roles def initialize(attributes={}) attributes.each do |k,v| if k.to_s == 'external_apps' self.external_apps = v.map { |x| ExternalAppExtended.new(x) } elsif k.to_s == 'roles' self.roles = v.map { |x| Role.new(x) } else self.send("#{k}=", v) end end end def name "#{first_name} #{last_name}" end def role_ids roles.map(&:id) end def app_codes external_apps.map(&:code) end def has_role?(role_id) role_ids.include?(role_id.to_i) end def has_some_role?(r_ids) r_ids.any? { |r_id| role_ids.include?(r_id.to_i) } end def has_all_roles?(r_ids) r_ids.all? { |r_id| role_ids.include?(r_id.to_i) } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
auth-lh-0.23.0 | lib/auth_lh/user_extended.rb |
auth-lh-0.22.0 | lib/auth_lh/user_extended.rb |
auth-lh-0.21.1 | lib/auth_lh/user_extended.rb |