Sha256: 7560dfbff4112ec75c0caba1cd5f6beb82b9bf769ff9ab060dbf51ecf63b86dd

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

module Lita
  module Handlers
    class Activedirectory < Handler
      namespace 'Activedirectory'
      config :host, required: true, type: String
      config :port, required: true, type: Integer, default: 389
      config :basedn, required: true, type: String
      config :username, required: true, type: String
      config :password, required: true, type: String

      route(
        /(is)\s+(\S+)\s+(locked(\?)?)/i,
        :user_locked?,
        command: true,
        help: { t('help.user_locked?.syntax') => t('help.user_locked?.desc') }
      )

      include ::Utils::Cratususer

      def user_locked?(response)
        user = response.matches[0][1]
        response.reply_with_mention(t('replies.user_locked?.working'))
        case user_query(user)
        when true
          response.reply_with_mention(
            t('replies.user_locked?.locked', user: user)
          )
        when false
          response.reply_with_mention(
            t('replies.user_locked?.notlocked', user: user)
          )
        when nil
          response.reply_with_mention(
            t('replies.user_locked?.error', user: user)
          )
        end
      end

      Lita.register_handler(self)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-activedirectory-0.0.4 lib/lita/handlers/activedirectory.rb