Sha256: ede79adbd28c0879882d28ef575edc14417dba434fe861f618e48f1ede41ce1c

Contents?: true

Size: 631 Bytes

Versions: 4

Compression:

Stored size: 631 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, :seller_code

    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

4 entries across 4 versions & 1 rubygems

Version Path
auth-lh-0.10.3 lib/auth_lh/user.rb
auth-lh-0.10.2 lib/auth_lh/user.rb
auth-lh-0.10.1 lib/auth_lh/user.rb
auth-lh-0.10.0 lib/auth_lh/user.rb