Sha256: 8f029f0b105b9eb3c1dc000251a81d52349bc329c6ba47b1518f13249d31a224

Contents?: true

Size: 617 Bytes

Versions: 1

Compression:

Stored size: 617 Bytes

Contents

module AuthLh
  class User
    attr_accessor :code, :email, :jabber, :name, :login, :shop_code,
      :shop_id, :shop_name, :enabled, :role_codes, :password_expired,
      :dni, :has_attendance_control, :external_apps

    def initialize(attributes={})
      attributes.each do |k,v|
        if k.to_s == 'external_apps'
          self.external_apps = v.map { |x| ExternalApp.new(x) }
        else
          self.send("#{k}=", v)
        end
      end
    end

    def password_expired?
      password_expired == true
    end

    def has_role?(role_code)
      role_codes.include?(role_code.to_s)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
auth-lh-0.9.0 lib/auth_lh/user.rb