otrs.rb 552 B

12345678910111213141516171819
  1. # Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
  2. module Sso::Otrs
  3. def self.check( params, config_item )
  4. endpoint = Setting.get('import_otrs_endpoint')
  5. return false if !endpoint || endpoint.empty? || endpoint == 'http://otrs_host/otrs'
  6. return false if !params['SessionID']
  7. # connect to OTRS
  8. result = Import::OTRS.session( params['SessionID'] )
  9. return false if !result
  10. user = User.where( :login => result['UserLogin'], :active => true ).first
  11. return user if user
  12. return false
  13. end
  14. end