Merge branch 'develop' of git.znuny.com:zammad/zammad into develop
This commit is contained in:
commit
12fb3c9126
122 changed files with 460 additions and 459 deletions
|
@ -226,3 +226,9 @@ Lint/AmbiguousBlockAssociation:
|
||||||
Exclude:
|
Exclude:
|
||||||
- "**/*_spec.rb"
|
- "**/*_spec.rb"
|
||||||
- "**/*_examples.rb"
|
- "**/*_examples.rb"
|
||||||
|
|
||||||
|
# Special exceptions
|
||||||
|
|
||||||
|
Style/HashSyntax:
|
||||||
|
Exclude:
|
||||||
|
- "**/*.rake"
|
||||||
|
|
2
Rakefile
2
Rakefile
|
@ -2,6 +2,6 @@
|
||||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||||
|
|
||||||
require File.expand_path('config/application', __dir__)
|
require_relative 'config/application'
|
||||||
|
|
||||||
Zammad::Application.load_tasks
|
Zammad::Application.load_tasks
|
||||||
|
|
|
@ -294,7 +294,7 @@ class ConnectionWizard extends App.WizardModal
|
||||||
|
|
||||||
option = ''
|
option = ''
|
||||||
options = {}
|
options = {}
|
||||||
if !_.isEmpty data.attributes && !_.isEmpty data.attributes.namingcontexts
|
if !_.isEmpty(data.attributes) && !_.isEmpty(data.attributes.namingcontexts)
|
||||||
for dn in data.attributes.namingcontexts
|
for dn in data.attributes.namingcontexts
|
||||||
options[dn] = dn
|
options[dn] = dn
|
||||||
if option is ''
|
if option is ''
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
require 'exceptions'
|
|
||||||
|
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
include ApplicationController::HandlesErrors
|
include ApplicationController::HandlesErrors
|
||||||
include ApplicationController::HandlesDevices
|
include ApplicationController::HandlesDevices
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
# Copyright (C) 2012-2015 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2015 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'icalendar'
|
|
||||||
|
|
||||||
class CalendarSubscriptionsController < ApplicationController
|
class CalendarSubscriptionsController < ApplicationController
|
||||||
prepend_before_action { authentication_check( { basic_auth_promt: true, permission: 'user_preferences.calendar' } ) }
|
prepend_before_action { authentication_check( { basic_auth_promt: true, permission: 'user_preferences.calendar' } ) }
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'resolv'
|
|
||||||
|
|
||||||
class GettingStartedController < ApplicationController
|
class GettingStartedController < ApplicationController
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
require 'zendesk_api'
|
|
||||||
|
|
||||||
class ImportZendeskController < ApplicationController
|
class ImportZendeskController < ApplicationController
|
||||||
|
|
||||||
def url_check
|
def url_check
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
require 'ldap'
|
require_dependency 'ldap'
|
||||||
require 'ldap/user'
|
require_dependency 'ldap/user'
|
||||||
require 'ldap/group'
|
require_dependency 'ldap/group'
|
||||||
|
|
||||||
class Integration::LdapController < ApplicationController
|
class Integration::LdapController < ApplicationController
|
||||||
include Integration::ImportJobBase
|
include Integration::ImportJobBase
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'builder'
|
require 'builder'
|
||||||
|
|
||||||
class Integration::SipgateController < ApplicationController
|
class Integration::SipgateController < ApplicationController
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'tempfile'
|
|
||||||
|
|
||||||
class ReportsController < ApplicationController
|
class ReportsController < ApplicationController
|
||||||
prepend_before_action { authentication_check(permission: 'report') }
|
prepend_before_action { authentication_check(permission: 'report') }
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'ticket/overviews'
|
|
||||||
|
|
||||||
class TicketOverviewsController < ApplicationController
|
class TicketOverviewsController < ApplicationController
|
||||||
prepend_before_action :authentication_check
|
prepend_before_action :authentication_check
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
class ActivityStream < ApplicationModel
|
class ActivityStream < ApplicationModel
|
||||||
load 'activity_stream/assets.rb'
|
|
||||||
include ActivityStream::Assets
|
include ActivityStream::Assets
|
||||||
|
|
||||||
self.table_name = 'activity_streams'
|
self.table_name = 'activity_streams'
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class ActivityStream
|
class ActivityStream
|
||||||
module Assets
|
module Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
class Channel < ApplicationModel
|
class Channel < ApplicationModel
|
||||||
load 'channel/assets.rb'
|
|
||||||
include Channel::Assets
|
include Channel::Assets
|
||||||
|
|
||||||
belongs_to :group
|
belongs_to :group
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class Channel
|
class Channel
|
||||||
module Assets
|
module Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
# Copyright (C) 2012-2015 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2015 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'facebook'
|
|
||||||
|
|
||||||
class Channel::Driver::Facebook
|
class Channel::Driver::Facebook
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
@ -38,7 +35,7 @@ class Channel::Driver::Facebook
|
||||||
if !access_token
|
if !access_token
|
||||||
raise "No access_token found for fb_object_id: #{fb_object_id}"
|
raise "No access_token found for fb_object_id: #{fb_object_id}"
|
||||||
end
|
end
|
||||||
client = Facebook.new(access_token)
|
client = ::Facebook.new(access_token)
|
||||||
client.from_article(article)
|
client.from_article(article)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -96,7 +93,7 @@ returns
|
||||||
page = get_page(page_to_sync_id)
|
page = get_page(page_to_sync_id)
|
||||||
next if !page
|
next if !page
|
||||||
next if page_to_sync_params['group_id'].blank?
|
next if page_to_sync_params['group_id'].blank?
|
||||||
page_client = Facebook.new(page['access_token'])
|
page_client = ::Facebook.new(page['access_token'])
|
||||||
|
|
||||||
posts = page_client.client.get_connection('me', 'feed', fields: 'id,from,to,message,created_time,permalink_url,comments{id,from,to,message,created_time}')
|
posts = page_client.client.get_connection('me', 'feed', fields: 'id,from,to,message,created_time,permalink_url,comments{id,from,to,message,created_time}')
|
||||||
posts.each do |post|
|
posts.each do |post|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'net/imap'
|
require 'net/imap'
|
||||||
|
|
||||||
class Channel::Driver::Imap < Channel::EmailParser
|
class Channel::Driver::Imap < Channel::EmailParser
|
||||||
|
@ -101,7 +100,7 @@ example
|
||||||
end
|
end
|
||||||
|
|
||||||
Timeout.timeout(timeout) do
|
Timeout.timeout(timeout) do
|
||||||
@imap = Net::IMAP.new(options[:host], port, ssl, nil, false)
|
@imap = ::Net::IMAP.new(options[:host], port, ssl, nil, false)
|
||||||
if starttls
|
if starttls
|
||||||
@imap.starttls()
|
@imap.starttls()
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,7 +62,7 @@ returns
|
||||||
|
|
||||||
Rails.logger.info "fetching pop3 (#{options[:host]}/#{options[:user]} port=#{port},ssl=#{ssl})"
|
Rails.logger.info "fetching pop3 (#{options[:host]}/#{options[:user]} port=#{port},ssl=#{ssl})"
|
||||||
|
|
||||||
@pop = Net::POP3.new(options[:host], port)
|
@pop = ::Net::POP3.new(options[:host], port)
|
||||||
#@pop.set_debug_output $stderr
|
#@pop.set_debug_output $stderr
|
||||||
|
|
||||||
# on check, reduce open_timeout to have faster probing
|
# on check, reduce open_timeout to have faster probing
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'mail'
|
|
||||||
|
|
||||||
module Channel::EmailBuild
|
module Channel::EmailBuild
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
|
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
require 'mail'
|
|
||||||
require 'encode'
|
|
||||||
|
|
||||||
class Channel::EmailParser
|
class Channel::EmailParser
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -2,10 +2,8 @@ class Chat::Session < ApplicationModel
|
||||||
include HasSearchIndexBackend
|
include HasSearchIndexBackend
|
||||||
include HasTags
|
include HasTags
|
||||||
|
|
||||||
extend Chat::Session::Search
|
include Chat::Session::Search
|
||||||
load 'chat/session/search_index.rb'
|
|
||||||
include Chat::Session::SearchIndex
|
include Chat::Session::SearchIndex
|
||||||
load 'chat/session/assets.rb'
|
|
||||||
include Chat::Session::Assets
|
include Chat::Session::Assets
|
||||||
|
|
||||||
# rubocop:disable Rails/InverseOf
|
# rubocop:disable Rails/InverseOf
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
module Chat::Session::Assets
|
module Chat::Session::Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
class Chat::Session
|
class Chat::Session
|
||||||
module Search
|
module Search
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
# methods defined here are going to extend the class, not the instance of it
|
||||||
|
class_methods do
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
@ -22,13 +25,13 @@ returns if user has no permissions to search
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def search_preferences(current_user)
|
def search_preferences(current_user)
|
||||||
return false if Setting.get('chat') != true || !current_user.permissions?('chat.agent')
|
return false if Setting.get('chat') != true || !current_user.permissions?('chat.agent')
|
||||||
{
|
{
|
||||||
prio: 900,
|
prio: 900,
|
||||||
direct_search_index: true,
|
direct_search_index: true,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
@ -47,36 +50,37 @@ returns
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def search(params)
|
def search(params)
|
||||||
|
|
||||||
# get params
|
# get params
|
||||||
query = params[:query]
|
query = params[:query]
|
||||||
limit = params[:limit] || 10
|
limit = params[:limit] || 10
|
||||||
offset = params[:offset] || 0
|
offset = params[:offset] || 0
|
||||||
current_user = params[:current_user]
|
current_user = params[:current_user]
|
||||||
|
|
||||||
# enable search only for agents and admins
|
# enable search only for agents and admins
|
||||||
return [] if !search_preferences(current_user)
|
return [] if !search_preferences(current_user)
|
||||||
|
|
||||||
# try search index backend
|
# try search index backend
|
||||||
if SearchIndexBackend.enabled?
|
if SearchIndexBackend.enabled?
|
||||||
items = SearchIndexBackend.search(query, limit, 'Chat::Session', {}, offset)
|
items = SearchIndexBackend.search(query, limit, 'Chat::Session', {}, offset)
|
||||||
chat_sessions = []
|
chat_sessions = []
|
||||||
items.each do |item|
|
items.each do |item|
|
||||||
chat_session = Chat::Session.lookup(id: item[:id])
|
chat_session = Chat::Session.lookup(id: item[:id])
|
||||||
next if !chat_session
|
next if !chat_session
|
||||||
chat_sessions.push chat_session
|
chat_sessions.push chat_session
|
||||||
|
end
|
||||||
|
return chat_sessions
|
||||||
end
|
end
|
||||||
return chat_sessions
|
|
||||||
end
|
|
||||||
|
|
||||||
# fallback do sql query
|
# fallback do sql query
|
||||||
# - stip out * we already search for *query* -
|
# - stip out * we already search for *query* -
|
||||||
query.delete! '*'
|
query.delete! '*'
|
||||||
chat_sessions = Chat::Session.where(
|
chat_sessions = Chat::Session.where(
|
||||||
'name LIKE ?', "%#{query}%"
|
'name LIKE ?', "%#{query}%"
|
||||||
).order('name').offset(offset).limit(limit).to_a
|
).order('name').offset(offset).limit(limit).to_a
|
||||||
chat_sessions
|
chat_sessions
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
module Chat::Session::SearchIndex
|
module Chat::Session::SearchIndex
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
# methods defined here are going to extend the class, not the instance of it
|
||||||
|
class_methods do
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
@ -14,23 +18,24 @@ returns
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def search_index_attribute_lookup
|
def search_index_attribute_lookup
|
||||||
attributes = super
|
attributes = super
|
||||||
return if !attributes
|
return if !attributes
|
||||||
|
|
||||||
attributes[:tag] = tag_list
|
attributes[:tag] = tag_list
|
||||||
|
|
||||||
messages = Chat::Message.where(chat_session_id: id)
|
messages = Chat::Message.where(chat_session_id: id)
|
||||||
attributes['messages'] = []
|
attributes['messages'] = []
|
||||||
messages.each do |message|
|
messages.each do |message|
|
||||||
|
|
||||||
# lookup attributes of ref. objects (normally name and note)
|
# lookup attributes of ref. objects (normally name and note)
|
||||||
message_attributes = message.search_index_attribute_lookup
|
message_attributes = message.search_index_attribute_lookup
|
||||||
|
|
||||||
attributes['messages'].push message_attributes
|
attributes['messages'].push message_attributes
|
||||||
|
end
|
||||||
|
|
||||||
|
attributes
|
||||||
end
|
end
|
||||||
|
|
||||||
attributes
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'csv'
|
require 'csv'
|
||||||
|
|
||||||
module CanCsvImport
|
module CanCsvImport
|
||||||
|
@ -58,7 +59,7 @@ returns
|
||||||
raise Exceptions::UnprocessableEntity, 'Unable to parse empty file/string!'
|
raise Exceptions::UnprocessableEntity, 'Unable to parse empty file/string!'
|
||||||
end
|
end
|
||||||
|
|
||||||
rows = CSV.parse(data[:string], data[:parse_params])
|
rows = ::CSV.parse(data[:string], data[:parse_params])
|
||||||
header = rows.shift
|
header = rows.shift
|
||||||
if header.blank?
|
if header.blank?
|
||||||
raise Exceptions::UnprocessableEntity, 'Unable to parse file/string without header!'
|
raise Exceptions::UnprocessableEntity, 'Unable to parse file/string without header!'
|
||||||
|
@ -301,7 +302,7 @@ returns
|
||||||
end
|
end
|
||||||
rows_to_add = []
|
rows_to_add = []
|
||||||
end
|
end
|
||||||
CSV.generate(params) do |csv|
|
::CSV.generate(params) do |csv|
|
||||||
csv << header
|
csv << header
|
||||||
rows.each do |row|
|
rows.each do |row|
|
||||||
csv << row
|
csv << row
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
class History < ApplicationModel
|
class History < ApplicationModel
|
||||||
load 'history/assets.rb'
|
|
||||||
include History::Assets
|
include History::Assets
|
||||||
|
|
||||||
self.table_name = 'histories'
|
self.table_name = 'histories'
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class History
|
class History
|
||||||
module Assets
|
module Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ class Job < ApplicationModel
|
||||||
include ChecksClientNotification
|
include ChecksClientNotification
|
||||||
include ChecksConditionValidation
|
include ChecksConditionValidation
|
||||||
|
|
||||||
load 'job/assets.rb'
|
|
||||||
include Job::Assets
|
include Job::Assets
|
||||||
|
|
||||||
store :timeplan
|
store :timeplan
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class Job
|
class Job
|
||||||
module Assets
|
module Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'history'
|
|
||||||
|
|
||||||
class Observer::Session < ActiveRecord::Observer
|
class Observer::Session < ActiveRecord::Observer
|
||||||
observe 'active_record::_session_store::_session'
|
observe 'active_record::_session_store::_session'
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'history'
|
|
||||||
|
|
||||||
class Observer::Tag::TicketHistory < ActiveRecord::Observer
|
class Observer::Tag::TicketHistory < ActiveRecord::Observer
|
||||||
observe 'tag'
|
observe 'tag'
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'channel/driver/facebook'
|
|
||||||
|
|
||||||
class Observer::Ticket::Article::CommunicateFacebook < ActiveRecord::Observer
|
class Observer::Ticket::Article::CommunicateFacebook < ActiveRecord::Observer
|
||||||
observe 'ticket::_article'
|
observe 'ticket::_article'
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
|
require_dependency 'stats/ticket_reopen'
|
||||||
|
|
||||||
class Observer::Ticket::StatsReopen < ActiveRecord::Observer
|
class Observer::Ticket::StatsReopen < ActiveRecord::Observer
|
||||||
load 'stats/ticket_reopen.rb'
|
|
||||||
|
|
||||||
observe 'ticket'
|
observe 'ticket'
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
class OnlineNotification < ApplicationModel
|
class OnlineNotification < ApplicationModel
|
||||||
load 'online_notification/assets.rb'
|
|
||||||
include OnlineNotification::Assets
|
include OnlineNotification::Assets
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class OnlineNotification
|
class OnlineNotification
|
||||||
module Assets
|
module Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,10 @@ class Organization < ApplicationModel
|
||||||
include HasHistory
|
include HasHistory
|
||||||
include HasSearchIndexBackend
|
include HasSearchIndexBackend
|
||||||
include CanCsvImport
|
include CanCsvImport
|
||||||
include Organization::ChecksAccess
|
|
||||||
|
|
||||||
load 'organization/assets.rb'
|
include Organization::ChecksAccess
|
||||||
include Organization::Assets
|
include Organization::Assets
|
||||||
extend Organization::Search
|
include Organization::Search
|
||||||
load 'organization/search_index.rb'
|
|
||||||
include Organization::SearchIndex
|
include Organization::SearchIndex
|
||||||
|
|
||||||
# rubocop:disable Rails/InverseOf
|
# rubocop:disable Rails/InverseOf
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class Organization
|
class Organization
|
||||||
module Assets
|
module Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
class Organization
|
class Organization
|
||||||
module Search
|
module Search
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
# methods defined here are going to extend the class, not the instance of it
|
||||||
|
class_methods do
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
@ -22,13 +26,13 @@ returns if user has no permissions to search
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def search_preferences(current_user)
|
def search_preferences(current_user)
|
||||||
return false if !current_user.permissions?('ticket.agent') && !current_user.permissions?('admin.organization')
|
return false if !current_user.permissions?('ticket.agent') && !current_user.permissions?('admin.organization')
|
||||||
{
|
{
|
||||||
prio: 1000,
|
prio: 1000,
|
||||||
direct_search_index: true,
|
direct_search_index: true,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
@ -47,60 +51,61 @@ returns
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def search(params)
|
def search(params)
|
||||||
|
|
||||||
# get params
|
# get params
|
||||||
query = params[:query]
|
query = params[:query]
|
||||||
limit = params[:limit] || 10
|
limit = params[:limit] || 10
|
||||||
offset = params[:offset] || 0
|
offset = params[:offset] || 0
|
||||||
current_user = params[:current_user]
|
current_user = params[:current_user]
|
||||||
|
|
||||||
# enable search only for agents and admins
|
# enable search only for agents and admins
|
||||||
return [] if !search_preferences(current_user)
|
return [] if !search_preferences(current_user)
|
||||||
|
|
||||||
# try search index backend
|
# try search index backend
|
||||||
if SearchIndexBackend.enabled?
|
if SearchIndexBackend.enabled?
|
||||||
items = SearchIndexBackend.search(query, limit, 'Organization', {}, offset)
|
items = SearchIndexBackend.search(query, limit, 'Organization', {}, offset)
|
||||||
organizations = []
|
organizations = []
|
||||||
items.each do |item|
|
items.each do |item|
|
||||||
organization = Organization.lookup(id: item[:id])
|
organization = Organization.lookup(id: item[:id])
|
||||||
next if !organization
|
next if !organization
|
||||||
organizations.push organization
|
organizations.push organization
|
||||||
end
|
end
|
||||||
return organizations
|
return organizations
|
||||||
end
|
|
||||||
|
|
||||||
# fallback do sql query
|
|
||||||
# - stip out * we already search for *query* -
|
|
||||||
query.delete! '*'
|
|
||||||
organizations = Organization.where(
|
|
||||||
'name LIKE ? OR note LIKE ?', "%#{query}%", "%#{query}%"
|
|
||||||
).order('name').offset(offset).limit(limit).to_a
|
|
||||||
|
|
||||||
# use result independent of size if an explicit offset is given
|
|
||||||
# this is the case for e.g. paginated searches
|
|
||||||
return organizations if params[:offset].present?
|
|
||||||
return organizations if organizations.length > 3
|
|
||||||
|
|
||||||
# if only a few organizations are found, search for names of users
|
|
||||||
organizations_by_user = Organization.select('DISTINCT(organizations.id), organizations.name').joins('LEFT OUTER JOIN users ON users.organization_id = organizations.id').where(
|
|
||||||
'users.firstname LIKE ? or users.lastname LIKE ? or users.email LIKE ?', "%#{query}%", "%#{query}%", "%#{query}%"
|
|
||||||
).order('organizations.name').limit(limit)
|
|
||||||
|
|
||||||
organizations_by_user.each do |organization_by_user|
|
|
||||||
|
|
||||||
organization_exists = false
|
|
||||||
organizations.each do |organization|
|
|
||||||
next if organization.id != organization_by_user.id
|
|
||||||
organization_exists = true
|
|
||||||
break
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# get model with full data
|
# fallback do sql query
|
||||||
next if organization_exists
|
# - stip out * we already search for *query* -
|
||||||
organizations.push Organization.find(organization_by_user.id)
|
query.delete! '*'
|
||||||
|
organizations = Organization.where(
|
||||||
|
'name LIKE ? OR note LIKE ?', "%#{query}%", "%#{query}%"
|
||||||
|
).order('name').offset(offset).limit(limit).to_a
|
||||||
|
|
||||||
|
# use result independent of size if an explicit offset is given
|
||||||
|
# this is the case for e.g. paginated searches
|
||||||
|
return organizations if params[:offset].present?
|
||||||
|
return organizations if organizations.length > 3
|
||||||
|
|
||||||
|
# if only a few organizations are found, search for names of users
|
||||||
|
organizations_by_user = Organization.select('DISTINCT(organizations.id), organizations.name').joins('LEFT OUTER JOIN users ON users.organization_id = organizations.id').where(
|
||||||
|
'users.firstname LIKE ? or users.lastname LIKE ? or users.email LIKE ?', "%#{query}%", "%#{query}%", "%#{query}%"
|
||||||
|
).order('organizations.name').limit(limit)
|
||||||
|
|
||||||
|
organizations_by_user.each do |organization_by_user|
|
||||||
|
|
||||||
|
organization_exists = false
|
||||||
|
organizations.each do |organization|
|
||||||
|
next if organization.id != organization_by_user.id
|
||||||
|
organization_exists = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
# get model with full data
|
||||||
|
next if organization_exists
|
||||||
|
organizations.push Organization.find(organization_by_user.id)
|
||||||
|
end
|
||||||
|
organizations
|
||||||
end
|
end
|
||||||
organizations
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class Organization
|
class Organization
|
||||||
module SearchIndex
|
module SearchIndex
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ class Overview < ApplicationModel
|
||||||
include ChecksConditionValidation
|
include ChecksConditionValidation
|
||||||
include CanSeed
|
include CanSeed
|
||||||
|
|
||||||
load 'overview/assets.rb'
|
|
||||||
include Overview::Assets
|
include Overview::Assets
|
||||||
|
|
||||||
has_and_belongs_to_many :roles, after_add: :cache_update, after_remove: :cache_update, class_name: 'Role'
|
has_and_belongs_to_many :roles, after_add: :cache_update, after_remove: :cache_update, class_name: 'Role'
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class Overview
|
class Overview
|
||||||
module Assets
|
module Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
class RecentView < ApplicationModel
|
class RecentView < ApplicationModel
|
||||||
load 'recent_view/assets.rb'
|
|
||||||
include RecentView::Assets
|
include RecentView::Assets
|
||||||
|
|
||||||
# rubocop:disable Rails/InverseOf
|
# rubocop:disable Rails/InverseOf
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class RecentView
|
class RecentView
|
||||||
module Assets
|
module Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ class Role < ApplicationModel
|
||||||
include ChecksLatestChangeObserved
|
include ChecksLatestChangeObserved
|
||||||
include HasGroups
|
include HasGroups
|
||||||
|
|
||||||
load 'role/assets.rb'
|
|
||||||
include Role::Assets
|
include Role::Assets
|
||||||
|
|
||||||
has_and_belongs_to_many :users, after_add: :cache_update, after_remove: :cache_update
|
has_and_belongs_to_many :users, after_add: :cache_update, after_remove: :cache_update
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class Role
|
class Role
|
||||||
module Assets
|
module Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
class Scheduler < ApplicationModel
|
class Scheduler < ApplicationModel
|
||||||
|
extend ::Mixin::StartFinishLogger
|
||||||
|
|
||||||
# rubocop:disable Style/ClassVars
|
# rubocop:disable Style/ClassVars
|
||||||
@@jobs_started = {}
|
@@jobs_started = {}
|
||||||
|
@ -120,8 +121,13 @@ class Scheduler < ApplicationModel
|
||||||
raise 'This method should only get called when Scheduler.threads are initialized. Use `force: true` to start anyway.'
|
raise 'This method should only get called when Scheduler.threads are initialized. Use `force: true` to start anyway.'
|
||||||
end
|
end
|
||||||
|
|
||||||
Delayed::Job.all.each do |job|
|
log_start_finish(:info, 'Cleanup of left over locked delayed jobs') do
|
||||||
cleanup_delayed(job)
|
|
||||||
|
Delayed::Job.all.each do |job|
|
||||||
|
log_start_finish(:info, "Checking left over delayed job #{job.inspect}") do
|
||||||
|
cleanup_delayed(job)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -172,7 +178,7 @@ class Scheduler < ApplicationModel
|
||||||
job.destroy
|
job.destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
Rails.logger.warn "#{action} locked delayed job: #{job_name}"
|
logger.warn "#{action} locked delayed job: #{job_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.start_job(job)
|
def self.start_job(job)
|
||||||
|
|
|
@ -4,7 +4,6 @@ class Sla < ApplicationModel
|
||||||
include ChecksClientNotification
|
include ChecksClientNotification
|
||||||
include ChecksConditionValidation
|
include ChecksConditionValidation
|
||||||
|
|
||||||
load 'sla/assets.rb'
|
|
||||||
include Sla::Assets
|
include Sla::Assets
|
||||||
|
|
||||||
store :condition
|
store :condition
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class Sla
|
class Sla
|
||||||
module Assets
|
module Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
class Store < ApplicationModel
|
require_dependency 'store/object'
|
||||||
load 'store/object.rb'
|
require_dependency 'store/file'
|
||||||
load 'store/file.rb'
|
|
||||||
|
|
||||||
|
class Store < ApplicationModel
|
||||||
# rubocop:disable Rails/InverseOf
|
# rubocop:disable Rails/InverseOf
|
||||||
belongs_to :store_object, class_name: 'Store::Object'
|
belongs_to :store_object, class_name: 'Store::Object'
|
||||||
belongs_to :store_file, class_name: 'Store::File'
|
belongs_to :store_file, class_name: 'Store::File'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
class Store
|
class Store < ApplicationModel
|
||||||
class File < ApplicationModel
|
class File < ApplicationModel
|
||||||
include ApplicationLib
|
include ApplicationLib
|
||||||
after_destroy :destroy_provider
|
after_destroy :destroy_provider
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
class Store
|
class Store < ApplicationModel
|
||||||
class Object < ApplicationModel
|
class Object < ApplicationModel
|
||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,11 +15,9 @@ class Ticket < ApplicationModel
|
||||||
|
|
||||||
include Ticket::Escalation
|
include Ticket::Escalation
|
||||||
include Ticket::Subject
|
include Ticket::Subject
|
||||||
load 'ticket/assets.rb'
|
|
||||||
include Ticket::Assets
|
include Ticket::Assets
|
||||||
load 'ticket/search_index.rb'
|
|
||||||
include Ticket::SearchIndex
|
include Ticket::SearchIndex
|
||||||
extend Ticket::Search
|
include Ticket::Search
|
||||||
|
|
||||||
store :preferences
|
store :preferences
|
||||||
before_create :check_generate, :check_defaults, :check_title, :set_default_state, :set_default_priority
|
before_create :check_generate, :check_defaults, :check_title, :set_default_state, :set_default_priority
|
||||||
|
|
|
@ -5,9 +5,8 @@ class Ticket::Article < ApplicationModel
|
||||||
include HasHistory
|
include HasHistory
|
||||||
include ChecksHtmlSanitized
|
include ChecksHtmlSanitized
|
||||||
include CanCsvImport
|
include CanCsvImport
|
||||||
include Ticket::Article::ChecksAccess
|
|
||||||
|
|
||||||
load 'ticket/article/assets.rb'
|
include Ticket::Article::ChecksAccess
|
||||||
include Ticket::Article::Assets
|
include Ticket::Article::Assets
|
||||||
|
|
||||||
belongs_to :ticket
|
belongs_to :ticket
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
module Ticket::Article::Assets
|
module Ticket::Article::Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
module Ticket::Assets
|
module Ticket::Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
module Ticket::Search
|
module Ticket::Search
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
# methods defined here are going to extend the class, not the instance of it
|
||||||
|
class_methods do
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
@ -20,12 +24,12 @@ returns if user has no permissions to search
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def search_preferences(_current_user)
|
def search_preferences(_current_user)
|
||||||
{
|
{
|
||||||
prio: 3000,
|
prio: 3000,
|
||||||
direct_search_index: false,
|
direct_search_index: false,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
@ -89,103 +93,104 @@ returns
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def search(params)
|
def search(params)
|
||||||
|
|
||||||
# get params
|
# get params
|
||||||
query = params[:query]
|
query = params[:query]
|
||||||
condition = params[:condition]
|
condition = params[:condition]
|
||||||
limit = params[:limit] || 12
|
limit = params[:limit] || 12
|
||||||
offset = params[:offset] || 0
|
offset = params[:offset] || 0
|
||||||
current_user = params[:current_user]
|
current_user = params[:current_user]
|
||||||
full = false
|
full = false
|
||||||
if params[:full] == true || params[:full] == 'true' || !params.key?(:full)
|
if params[:full] == true || params[:full] == 'true' || !params.key?(:full)
|
||||||
full = true
|
full = true
|
||||||
end
|
|
||||||
|
|
||||||
# try search index backend
|
|
||||||
if condition.blank? && SearchIndexBackend.enabled?
|
|
||||||
query_extention = {}
|
|
||||||
query_extention['bool'] = {}
|
|
||||||
query_extention['bool']['must'] = []
|
|
||||||
|
|
||||||
if current_user.permissions?('ticket.agent')
|
|
||||||
group_ids = current_user.group_ids_access('read')
|
|
||||||
access_condition = {
|
|
||||||
'query_string' => { 'default_field' => 'group_id', 'query' => "\"#{group_ids.join('" OR "')}\"" }
|
|
||||||
}
|
|
||||||
else
|
|
||||||
access_condition = if !current_user.organization || ( !current_user.organization.shared || current_user.organization.shared == false )
|
|
||||||
{
|
|
||||||
'query_string' => { 'default_field' => 'customer_id', 'query' => current_user.id }
|
|
||||||
}
|
|
||||||
# customer_id: XXX
|
|
||||||
# conditions = [ 'customer_id = ?', current_user.id ]
|
|
||||||
else
|
|
||||||
{
|
|
||||||
'query_string' => { 'query' => "customer_id:#{current_user.id} OR organization_id:#{current_user.organization.id}" }
|
|
||||||
}
|
|
||||||
# customer_id: XXX OR organization_id: XXX
|
|
||||||
# conditions = [ '( customer_id = ? OR organization_id = ? )', current_user.id, current_user.organization.id ]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
query_extention['bool']['must'].push access_condition
|
# try search index backend
|
||||||
|
if condition.blank? && SearchIndexBackend.enabled?
|
||||||
|
query_extention = {}
|
||||||
|
query_extention['bool'] = {}
|
||||||
|
query_extention['bool']['must'] = []
|
||||||
|
|
||||||
items = SearchIndexBackend.search(query, limit, 'Ticket', query_extention, offset)
|
if current_user.permissions?('ticket.agent')
|
||||||
|
group_ids = current_user.group_ids_access('read')
|
||||||
|
access_condition = {
|
||||||
|
'query_string' => { 'default_field' => 'group_id', 'query' => "\"#{group_ids.join('" OR "')}\"" }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
access_condition = if !current_user.organization || ( !current_user.organization.shared || current_user.organization.shared == false )
|
||||||
|
{
|
||||||
|
'query_string' => { 'default_field' => 'customer_id', 'query' => current_user.id }
|
||||||
|
}
|
||||||
|
# customer_id: XXX
|
||||||
|
# conditions = [ 'customer_id = ?', current_user.id ]
|
||||||
|
else
|
||||||
|
{
|
||||||
|
'query_string' => { 'query' => "customer_id:#{current_user.id} OR organization_id:#{current_user.organization.id}" }
|
||||||
|
}
|
||||||
|
# customer_id: XXX OR organization_id: XXX
|
||||||
|
# conditions = [ '( customer_id = ? OR organization_id = ? )', current_user.id, current_user.organization.id ]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
query_extention['bool']['must'].push access_condition
|
||||||
|
|
||||||
|
items = SearchIndexBackend.search(query, limit, 'Ticket', query_extention, offset)
|
||||||
|
if !full
|
||||||
|
ids = []
|
||||||
|
items.each do |item|
|
||||||
|
ids.push item[:id]
|
||||||
|
end
|
||||||
|
return ids
|
||||||
|
end
|
||||||
|
tickets = []
|
||||||
|
items.each do |item|
|
||||||
|
ticket = Ticket.lookup(id: item[:id])
|
||||||
|
next if !ticket
|
||||||
|
tickets.push ticket
|
||||||
|
end
|
||||||
|
return tickets
|
||||||
|
end
|
||||||
|
|
||||||
|
# fallback do sql query
|
||||||
|
access_condition = Ticket.access_condition(current_user, 'read')
|
||||||
|
|
||||||
|
# do query
|
||||||
|
# - stip out * we already search for *query* -
|
||||||
|
if query
|
||||||
|
query.delete! '*'
|
||||||
|
tickets_all = Ticket.select('DISTINCT(tickets.id), tickets.created_at')
|
||||||
|
.where(access_condition)
|
||||||
|
.where('(tickets.title LIKE ? OR tickets.number LIKE ? OR ticket_articles.body LIKE ? OR ticket_articles.from LIKE ? OR ticket_articles.to LIKE ? OR ticket_articles.subject LIKE ?)', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%" )
|
||||||
|
.joins(:articles)
|
||||||
|
.order('tickets.created_at DESC')
|
||||||
|
.offset(offset)
|
||||||
|
.limit(limit)
|
||||||
|
else
|
||||||
|
query_condition, bind_condition, tables = selector2sql(condition)
|
||||||
|
tickets_all = Ticket.select('DISTINCT(tickets.id), tickets.created_at')
|
||||||
|
.joins(tables)
|
||||||
|
.where(access_condition)
|
||||||
|
.where(query_condition, *bind_condition)
|
||||||
|
.order('tickets.created_at DESC')
|
||||||
|
.offset(offset)
|
||||||
|
.limit(limit)
|
||||||
|
end
|
||||||
|
|
||||||
|
# build result list
|
||||||
if !full
|
if !full
|
||||||
ids = []
|
ids = []
|
||||||
items.each do |item|
|
tickets_all.each do |ticket|
|
||||||
ids.push item[:id]
|
ids.push ticket.id
|
||||||
end
|
end
|
||||||
return ids
|
return ids
|
||||||
end
|
end
|
||||||
|
|
||||||
tickets = []
|
tickets = []
|
||||||
items.each do |item|
|
|
||||||
ticket = Ticket.lookup(id: item[:id])
|
|
||||||
next if !ticket
|
|
||||||
tickets.push ticket
|
|
||||||
end
|
|
||||||
return tickets
|
|
||||||
end
|
|
||||||
|
|
||||||
# fallback do sql query
|
|
||||||
access_condition = Ticket.access_condition(current_user, 'read')
|
|
||||||
|
|
||||||
# do query
|
|
||||||
# - stip out * we already search for *query* -
|
|
||||||
if query
|
|
||||||
query.delete! '*'
|
|
||||||
tickets_all = Ticket.select('DISTINCT(tickets.id), tickets.created_at')
|
|
||||||
.where(access_condition)
|
|
||||||
.where('(tickets.title LIKE ? OR tickets.number LIKE ? OR ticket_articles.body LIKE ? OR ticket_articles.from LIKE ? OR ticket_articles.to LIKE ? OR ticket_articles.subject LIKE ?)', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%" )
|
|
||||||
.joins(:articles)
|
|
||||||
.order('tickets.created_at DESC')
|
|
||||||
.offset(offset)
|
|
||||||
.limit(limit)
|
|
||||||
else
|
|
||||||
query_condition, bind_condition, tables = selector2sql(condition)
|
|
||||||
tickets_all = Ticket.select('DISTINCT(tickets.id), tickets.created_at')
|
|
||||||
.joins(tables)
|
|
||||||
.where(access_condition)
|
|
||||||
.where(query_condition, *bind_condition)
|
|
||||||
.order('tickets.created_at DESC')
|
|
||||||
.offset(offset)
|
|
||||||
.limit(limit)
|
|
||||||
end
|
|
||||||
|
|
||||||
# build result list
|
|
||||||
if !full
|
|
||||||
ids = []
|
|
||||||
tickets_all.each do |ticket|
|
tickets_all.each do |ticket|
|
||||||
ids.push ticket.id
|
tickets.push Ticket.lookup(id: ticket.id)
|
||||||
end
|
end
|
||||||
return ids
|
tickets
|
||||||
end
|
end
|
||||||
|
|
||||||
tickets = []
|
|
||||||
tickets_all.each do |ticket|
|
|
||||||
tickets.push Ticket.lookup(id: ticket.id)
|
|
||||||
end
|
|
||||||
tickets
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
module Ticket::SearchIndex
|
module Ticket::SearchIndex
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
require 'signature_detection'
|
|
||||||
|
|
||||||
class Transaction::CtiCallerIdDetection
|
class Transaction::CtiCallerIdDetection
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
require 'signature_detection'
|
|
||||||
|
|
||||||
class Transaction::SignatureDetection
|
class Transaction::SignatureDetection
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
@ -46,14 +44,14 @@ class Transaction::SignatureDetection
|
||||||
return if type['name'] != 'email'
|
return if type['name'] != 'email'
|
||||||
|
|
||||||
# update current signature of user id
|
# update current signature of user id
|
||||||
SignatureDetection.rebuild_user(article.created_by_id)
|
::SignatureDetection.rebuild_user(article.created_by_id)
|
||||||
|
|
||||||
# user
|
# user
|
||||||
user = User.lookup(id: article.created_by_id)
|
user = User.lookup(id: article.created_by_id)
|
||||||
return if !user
|
return if !user
|
||||||
return if !user.preferences
|
return if !user.preferences
|
||||||
return if !user.preferences[:signature_detection]
|
return if !user.preferences[:signature_detection]
|
||||||
line = SignatureDetection.find_signature_line_by_article(
|
line = ::SignatureDetection.find_signature_line_by_article(
|
||||||
user,
|
user,
|
||||||
article
|
article
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,7 +4,6 @@ class Trigger < ApplicationModel
|
||||||
include ChecksConditionValidation
|
include ChecksConditionValidation
|
||||||
include CanSeed
|
include CanSeed
|
||||||
|
|
||||||
load 'trigger/assets.rb'
|
|
||||||
include Trigger::Assets
|
include Trigger::Assets
|
||||||
|
|
||||||
store :condition
|
store :condition
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class Trigger
|
class Trigger
|
||||||
module Assets
|
module Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,4 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'digest/md5'
|
|
||||||
|
|
||||||
# @model User
|
|
||||||
#
|
|
||||||
# @property id(required) [Integer] The identifier for the User.
|
|
||||||
# @property login(required) [String] The login of the User used for authentication.
|
|
||||||
# @property firstname [String] The firstname of the User.
|
|
||||||
# @property lastname [String] The lastname of the User.
|
|
||||||
# @property email [String] The email of the User.
|
|
||||||
# @property image [String] The Image used as the User avatar (TODO: Image model?).
|
|
||||||
# @property web [String] The website/URL of the User.
|
|
||||||
# @property password [String] The password of the User.
|
|
||||||
# @property phone [String] The phone number of the User.
|
|
||||||
# @property fax [String] The fax number of the User.
|
|
||||||
# @property mobile [String] The mobile number of the User.
|
|
||||||
# @property department [String] The department the User is working at.
|
|
||||||
# @property street [String] The street the User lives in.
|
|
||||||
# @property zip [Integer] The zip postal code of the User city.
|
|
||||||
# @property city [String] The city the User lives in.
|
|
||||||
# @property country [String] The country the User lives in.
|
|
||||||
# @property verified [Boolean] The flag that shows the verified state of the User.
|
|
||||||
# @property active [Boolean] The flag that shows the active state of the User.
|
|
||||||
# @property note [String] The note or comment stored to the User.
|
|
||||||
class User < ApplicationModel
|
class User < ApplicationModel
|
||||||
include HasActivityStreamLog
|
include HasActivityStreamLog
|
||||||
include ChecksClientNotification
|
include ChecksClientNotification
|
||||||
|
@ -31,12 +7,10 @@ class User < ApplicationModel
|
||||||
include CanCsvImport
|
include CanCsvImport
|
||||||
include HasGroups
|
include HasGroups
|
||||||
include HasRoles
|
include HasRoles
|
||||||
include User::ChecksAccess
|
|
||||||
|
|
||||||
load 'user/assets.rb'
|
include User::ChecksAccess
|
||||||
include User::Assets
|
include User::Assets
|
||||||
extend User::Search
|
include User::Search
|
||||||
load 'user/search_index.rb'
|
|
||||||
include User::SearchIndex
|
include User::SearchIndex
|
||||||
|
|
||||||
has_and_belongs_to_many :roles, after_add: %i[cache_update check_notifications], after_remove: :cache_update, before_add: %i[validate_agent_limit_by_role validate_roles], before_remove: :last_admin_check_by_role, class_name: 'Role'
|
has_and_belongs_to_many :roles, after_add: %i[cache_update check_notifications], after_remove: :cache_update, before_add: %i[validate_agent_limit_by_role validate_roles], before_remove: :last_admin_check_by_role, class_name: 'Role'
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class User
|
class User
|
||||||
module Assets
|
module Assets
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
class User
|
class User
|
||||||
module Search
|
module Search
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
# methods defined here are going to extend the class, not the instance of it
|
||||||
|
class_methods do
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
@ -22,13 +26,13 @@ returns if user has no permissions to search
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def search_preferences(current_user)
|
def search_preferences(current_user)
|
||||||
return false if !current_user.permissions?('ticket.agent') && !current_user.permissions?('admin.user')
|
return false if !current_user.permissions?('ticket.agent') && !current_user.permissions?('admin.user')
|
||||||
{
|
{
|
||||||
prio: 2000,
|
prio: 2000,
|
||||||
direct_search_index: true,
|
direct_search_index: true,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
@ -58,61 +62,62 @@ returns
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def search(params)
|
def search(params)
|
||||||
|
|
||||||
# get params
|
# get params
|
||||||
query = params[:query]
|
query = params[:query]
|
||||||
limit = params[:limit] || 10
|
limit = params[:limit] || 10
|
||||||
offset = params[:offset] || 0
|
offset = params[:offset] || 0
|
||||||
current_user = params[:current_user]
|
current_user = params[:current_user]
|
||||||
|
|
||||||
# enable search only for agents and admins
|
# enable search only for agents and admins
|
||||||
return [] if !search_preferences(current_user)
|
return [] if !search_preferences(current_user)
|
||||||
|
|
||||||
# lookup for roles of permission
|
# lookup for roles of permission
|
||||||
if params[:permissions].present?
|
if params[:permissions].present?
|
||||||
params[:role_ids] ||= []
|
params[:role_ids] ||= []
|
||||||
role_ids = Role.with_permissions(params[:permissions]).pluck(:id)
|
role_ids = Role.with_permissions(params[:permissions]).pluck(:id)
|
||||||
params[:role_ids].concat(role_ids)
|
params[:role_ids].concat(role_ids)
|
||||||
end
|
end
|
||||||
|
|
||||||
# try search index backend
|
# try search index backend
|
||||||
if SearchIndexBackend.enabled?
|
if SearchIndexBackend.enabled?
|
||||||
query_extention = {}
|
query_extention = {}
|
||||||
if params[:role_ids].present?
|
if params[:role_ids].present?
|
||||||
query_extention['bool'] = {}
|
query_extention['bool'] = {}
|
||||||
query_extention['bool']['must'] = []
|
query_extention['bool']['must'] = []
|
||||||
if !params[:role_ids].is_a?(Array)
|
if !params[:role_ids].is_a?(Array)
|
||||||
params[:role_ids] = [params[:role_ids]]
|
params[:role_ids] = [params[:role_ids]]
|
||||||
|
end
|
||||||
|
access_condition = {
|
||||||
|
'query_string' => { 'default_field' => 'role_ids', 'query' => "\"#{params[:role_ids].join('" OR "')}\"" }
|
||||||
|
}
|
||||||
|
query_extention['bool']['must'].push access_condition
|
||||||
end
|
end
|
||||||
access_condition = {
|
items = SearchIndexBackend.search(query, limit, 'User', query_extention, offset)
|
||||||
'query_string' => { 'default_field' => 'role_ids', 'query' => "\"#{params[:role_ids].join('" OR "')}\"" }
|
users = []
|
||||||
}
|
items.each do |item|
|
||||||
query_extention['bool']['must'].push access_condition
|
user = User.lookup(id: item[:id])
|
||||||
|
next if !user
|
||||||
|
users.push user
|
||||||
|
end
|
||||||
|
return users
|
||||||
end
|
end
|
||||||
items = SearchIndexBackend.search(query, limit, 'User', query_extention, offset)
|
|
||||||
users = []
|
|
||||||
items.each do |item|
|
|
||||||
user = User.lookup(id: item[:id])
|
|
||||||
next if !user
|
|
||||||
users.push user
|
|
||||||
end
|
|
||||||
return users
|
|
||||||
end
|
|
||||||
|
|
||||||
# fallback do sql query
|
# fallback do sql query
|
||||||
# - stip out * we already search for *query* -
|
# - stip out * we already search for *query* -
|
||||||
query.delete! '*'
|
query.delete! '*'
|
||||||
users = if params[:role_ids]
|
users = if params[:role_ids]
|
||||||
User.joins(:roles).where('roles.id' => params[:role_ids]).where(
|
User.joins(:roles).where('roles.id' => params[:role_ids]).where(
|
||||||
'(users.firstname LIKE ? OR users.lastname LIKE ? OR users.email LIKE ? OR users.login LIKE ?) AND users.id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
|
'(users.firstname LIKE ? OR users.lastname LIKE ? OR users.email LIKE ? OR users.login LIKE ?) AND users.id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
|
||||||
).order('updated_at DESC').offset(offset).limit(limit)
|
).order('updated_at DESC').offset(offset).limit(limit)
|
||||||
else
|
else
|
||||||
User.where(
|
User.where(
|
||||||
'(firstname LIKE ? OR lastname LIKE ? OR email LIKE ? OR login LIKE ?) AND id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
|
'(firstname LIKE ? OR lastname LIKE ? OR email LIKE ? OR login LIKE ?) AND id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
|
||||||
).order('updated_at DESC').offset(offset).limit(limit)
|
).order('updated_at DESC').offset(offset).limit(limit)
|
||||||
end
|
end
|
||||||
users
|
users
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
class User
|
class User
|
||||||
module SearchIndex
|
module SearchIndex
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
@ -67,6 +68,5 @@ returns
|
||||||
|
|
||||||
attributes
|
attributes
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'ldap'
|
require_dependency 'ldap'
|
||||||
require 'ldap/user'
|
require_dependency 'ldap/user'
|
||||||
|
|
||||||
class Auth
|
class Auth
|
||||||
class Ldap < Auth::Base
|
class Ldap < Auth::Base
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#require 'iconv'
|
|
||||||
module Encode
|
module Encode
|
||||||
def self.conv (charset, string)
|
def self.conv (charset, string)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# Copyright (C) 2012-2015 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2015 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'koala'
|
|
||||||
|
|
||||||
class Facebook
|
class Facebook
|
||||||
|
|
||||||
attr_accessor :client, :account
|
attr_accessor :client, :account
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'mixin/rails_logger'
|
require_dependency 'mixin/rails_logger'
|
||||||
|
|
||||||
module Import
|
module Import
|
||||||
class Exchange
|
class Exchange
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'ldap'
|
require_dependency 'ldap'
|
||||||
require 'ldap/group'
|
require_dependency 'ldap/group'
|
||||||
|
|
||||||
module Import
|
module Import
|
||||||
class Ldap < Import::IntegrationBase
|
class Ldap < Import::IntegrationBase
|
||||||
|
|
|
@ -2,24 +2,24 @@
|
||||||
# in the importer folder require AND simultaniuos requiring
|
# in the importer folder require AND simultaniuos requiring
|
||||||
# of the same file in different threads so we need to
|
# of the same file in different threads so we need to
|
||||||
# require them ourself
|
# require them ourself
|
||||||
require 'import/otrs/ticket'
|
require_dependency 'import/otrs/ticket'
|
||||||
require 'import/otrs/ticket_factory'
|
require_dependency 'import/otrs/ticket_factory'
|
||||||
require 'import/otrs/article_customer'
|
require_dependency 'import/otrs/article_customer'
|
||||||
require 'import/otrs/article_customer_factory'
|
require_dependency 'import/otrs/article_customer_factory'
|
||||||
require 'import/otrs/article'
|
require_dependency 'import/otrs/article'
|
||||||
require 'import/otrs/article_factory'
|
require_dependency 'import/otrs/article_factory'
|
||||||
require 'import/otrs/article/attachment_factory'
|
require_dependency 'import/otrs/article/attachment_factory'
|
||||||
require 'import/otrs/history'
|
require_dependency 'import/otrs/history'
|
||||||
require 'import/otrs/history_factory'
|
require_dependency 'import/otrs/history_factory'
|
||||||
require 'import/otrs/history/article'
|
require_dependency 'import/otrs/history/article'
|
||||||
require 'import/otrs/history/move'
|
require_dependency 'import/otrs/history/move'
|
||||||
require 'import/otrs/history/new_ticket'
|
require_dependency 'import/otrs/history/new_ticket'
|
||||||
require 'import/otrs/history/priority_update'
|
require_dependency 'import/otrs/history/priority_update'
|
||||||
require 'import/otrs/history/state_update'
|
require_dependency 'import/otrs/history/state_update'
|
||||||
require 'store'
|
require_dependency 'store'
|
||||||
require 'store/object'
|
require_dependency 'store/object'
|
||||||
require 'store/provider/db'
|
require_dependency 'store/provider/db'
|
||||||
require 'store/provider/file'
|
require_dependency 'store/provider/file'
|
||||||
|
|
||||||
module Import
|
module Import
|
||||||
module OTRS
|
module OTRS
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# this require is required (hehe) because of Rails autoloading
|
# this require is required (hehe) because of Rails autoloading
|
||||||
# which causes strange behavior not inheriting correctly
|
# which causes strange behavior not inheriting correctly
|
||||||
# from Import::OTRS::DynamicField
|
# from Import::OTRS::DynamicField
|
||||||
require 'import/otrs/dynamic_field'
|
require_dependency 'import/otrs/dynamic_field'
|
||||||
|
|
||||||
module Import
|
module Import
|
||||||
module OTRS
|
module OTRS
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# this require is required (hehe) because of Rails autoloading
|
# this require is required (hehe) because of Rails autoloading
|
||||||
# which causes strange behavior not inheriting correctly
|
# which causes strange behavior not inheriting correctly
|
||||||
# from Import::OTRS::DynamicField
|
# from Import::OTRS::DynamicField
|
||||||
require 'import/otrs/dynamic_field'
|
require_dependency 'import/otrs/dynamic_field'
|
||||||
|
|
||||||
module Import
|
module Import
|
||||||
module OTRS
|
module OTRS
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'ticket'
|
require_dependency 'ticket'
|
||||||
|
|
||||||
module Import
|
module Import
|
||||||
module OTRS
|
module OTRS
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# this require is required (hehe) because of Rails autoloading
|
# this require is required (hehe) because of Rails autoloading
|
||||||
# which causes strange behavior not inheriting correctly
|
# which causes strange behavior not inheriting correctly
|
||||||
# from Import::OTRS::DynamicField
|
# from Import::OTRS::DynamicField
|
||||||
require 'import/zendesk/object_attribute/base'
|
require_dependency 'import/zendesk/object_attribute/base'
|
||||||
|
|
||||||
module Import
|
module Import
|
||||||
class Zendesk
|
class Zendesk
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# this require is required (hehe) because of Rails autoloading
|
# this require is required (hehe) because of Rails autoloading
|
||||||
# which causes strange behavior not inheriting correctly
|
# which causes strange behavior not inheriting correctly
|
||||||
# from Import::OTRS::DynamicField
|
# from Import::OTRS::DynamicField
|
||||||
require 'import/zendesk/object_attribute/base'
|
require_dependency 'import/zendesk/object_attribute/base'
|
||||||
|
|
||||||
module Import
|
module Import
|
||||||
class Zendesk
|
class Zendesk
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# this require is required (hehe) because of Rails autoloading
|
# this require is required (hehe) because of Rails autoloading
|
||||||
# which causes strange behavior not inheriting correctly
|
# which causes strange behavior not inheriting correctly
|
||||||
# from Import::OTRS::DynamicField
|
# from Import::OTRS::DynamicField
|
||||||
require 'import/zendesk/object_attribute/base'
|
require_dependency 'import/zendesk/object_attribute/base'
|
||||||
|
|
||||||
module Import
|
module Import
|
||||||
class Zendesk
|
class Zendesk
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# this require is required (hehe) because of Rails autoloading
|
# this require is required (hehe) because of Rails autoloading
|
||||||
# which causes strange behavior not inheriting correctly
|
# which causes strange behavior not inheriting correctly
|
||||||
# from Import::OTRS::DynamicField
|
# from Import::OTRS::DynamicField
|
||||||
require 'import/zendesk/object_attribute/base'
|
require_dependency 'import/zendesk/object_attribute/base'
|
||||||
|
|
||||||
module Import
|
module Import
|
||||||
class Zendesk
|
class Zendesk
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# this require is required (hehe) because of Rails autoloading
|
# this require is required (hehe) because of Rails autoloading
|
||||||
# which causes strange behavior not inheriting correctly
|
# which causes strange behavior not inheriting correctly
|
||||||
# from Import::OTRS::DynamicField
|
# from Import::OTRS::DynamicField
|
||||||
require 'import/zendesk/object_attribute/base'
|
require_dependency 'import/zendesk/object_attribute/base'
|
||||||
|
|
||||||
module Import
|
module Import
|
||||||
class Zendesk
|
class Zendesk
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# this require is required (hehe) because of Rails autoloading
|
# this require is required (hehe) because of Rails autoloading
|
||||||
# which causes strange behavior not inheriting correctly
|
# which causes strange behavior not inheriting correctly
|
||||||
# from Import::OTRS::DynamicField
|
# from Import::OTRS::DynamicField
|
||||||
require 'import/zendesk/object_attribute/base'
|
require_dependency 'import/zendesk/object_attribute/base'
|
||||||
|
|
||||||
module Import
|
module Import
|
||||||
class Zendesk
|
class Zendesk
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# this require is required (hehe) because of Rails autoloading
|
# this require is required (hehe) because of Rails autoloading
|
||||||
# which causes strange behavior not inheriting correctly
|
# which causes strange behavior not inheriting correctly
|
||||||
# from Import::OTRS::DynamicField
|
# from Import::OTRS::DynamicField
|
||||||
require 'import/zendesk/object_attribute/base'
|
require_dependency 'import/zendesk/object_attribute/base'
|
||||||
|
|
||||||
module Import
|
module Import
|
||||||
class Zendesk
|
class Zendesk
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
||||||
require 'net/ldap'
|
require_dependency 'net/ldap'
|
||||||
require 'net/ldap/entry'
|
require_dependency 'net/ldap/entry'
|
||||||
|
|
||||||
# Class for establishing LDAP connections. A wrapper around Net::LDAP needed for Auth and Sync.
|
# Class for establishing LDAP connections. A wrapper around Net::LDAP needed for Auth and Sync.
|
||||||
# ATTENTION: Loads custom 'net/ldap/entry' from 'lib/core_ext' which extends the Net::LDAP::Entry class.
|
# ATTENTION: Loads custom 'net/ldap/entry' from 'lib/core_ext' which extends the Net::LDAP::Entry class.
|
||||||
|
|
|
@ -6,8 +6,8 @@ class Ldap
|
||||||
# an ::Ldap instance.
|
# an ::Ldap instance.
|
||||||
#
|
#
|
||||||
# @example
|
# @example
|
||||||
# require 'ldap'
|
# require_dependency 'ldap'
|
||||||
# require 'ldap/group'
|
# require_dependency 'ldap/group'
|
||||||
class Group
|
class Group
|
||||||
include Ldap::FilterLookup
|
include Ldap::FilterLookup
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ class Ldap
|
||||||
# @param ldap [Ldap] An optional existing Ldap class instance. Default is a new connection with given configuration.
|
# @param ldap [Ldap] An optional existing Ldap class instance. Default is a new connection with given configuration.
|
||||||
#
|
#
|
||||||
# @example
|
# @example
|
||||||
# require 'ldap'
|
# require_dependency 'ldap'
|
||||||
# require 'ldap/group'
|
# require_dependency 'ldap/group'
|
||||||
# ldap_group = Ldap::Group.new
|
# ldap_group = Ldap::Group.new
|
||||||
#
|
#
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
|
|
|
@ -6,8 +6,8 @@ class Ldap
|
||||||
# an ::Ldap instance.
|
# an ::Ldap instance.
|
||||||
#
|
#
|
||||||
# @example
|
# @example
|
||||||
# require 'ldap'
|
# require_dependency 'ldap'
|
||||||
# require 'ldap/user'
|
# require_dependency 'ldap/user'
|
||||||
class User
|
class User
|
||||||
include Ldap::FilterLookup
|
include Ldap::FilterLookup
|
||||||
|
|
||||||
|
@ -76,8 +76,8 @@ class Ldap
|
||||||
# @param ldap [Ldap] An optional existing Ldap class instance. Default is a new connection with given configuration.
|
# @param ldap [Ldap] An optional existing Ldap class instance. Default is a new connection with given configuration.
|
||||||
#
|
#
|
||||||
# @example
|
# @example
|
||||||
# require 'ldap'
|
# require_dependency 'ldap'
|
||||||
# require 'ldap/user'
|
# require_dependency 'ldap/user'
|
||||||
# ldap_user = Ldap::User.new
|
# ldap_user = Ldap::User.new
|
||||||
#
|
#
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'ldap'
|
require_dependency 'ldap'
|
||||||
require 'ldap/user'
|
require_dependency 'ldap/user'
|
||||||
|
|
||||||
module MigrationJob
|
module MigrationJob
|
||||||
class LdapSamaccountnameToUid
|
class LdapSamaccountnameToUid
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'mixin/rails_logger'
|
require_dependency 'mixin/rails_logger'
|
||||||
require 'mixin/start_finish_logger'
|
require_dependency 'mixin/start_finish_logger'
|
||||||
|
|
||||||
class Sequencer
|
class Sequencer
|
||||||
include ::Mixin::RailsLogger
|
include ::Mixin::RailsLogger
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'sequencer/mixin/prefixed_constantize'
|
require_dependency 'sequencer/mixin/prefixed_constantize'
|
||||||
|
|
||||||
class Sequencer
|
class Sequencer
|
||||||
class Sequence
|
class Sequence
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'mixin/rails_logger'
|
require_dependency 'mixin/rails_logger'
|
||||||
require 'mixin/start_finish_logger'
|
require_dependency 'mixin/start_finish_logger'
|
||||||
|
|
||||||
class Sequencer
|
class Sequencer
|
||||||
class State
|
class State
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'sequencer/mixin/prefixed_constantize'
|
require_dependency 'sequencer/mixin/prefixed_constantize'
|
||||||
|
|
||||||
class Sequencer
|
class Sequencer
|
||||||
class Unit
|
class Unit
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'mixin/rails_logger'
|
require_dependency 'mixin/rails_logger'
|
||||||
|
|
||||||
class Sequencer
|
class Sequencer
|
||||||
class Unit
|
class Unit
|
||||||
|
|
|
@ -5,8 +5,12 @@ class Sequencer
|
||||||
module Mapping
|
module Mapping
|
||||||
class FlatKeys < Sequencer::Unit::Base
|
class FlatKeys < Sequencer::Unit::Base
|
||||||
include ::Sequencer::Unit::Import::Common::Mapping::Mixin::ProvideMapped
|
include ::Sequencer::Unit::Import::Common::Mapping::Mixin::ProvideMapped
|
||||||
|
prepend ::Sequencer::Unit::Import::Common::Model::Mixin::Skip::Action
|
||||||
|
|
||||||
|
skip_any_action
|
||||||
|
|
||||||
uses :resource
|
uses :resource
|
||||||
|
provides :mapped
|
||||||
|
|
||||||
def process
|
def process
|
||||||
provide_mapped do
|
provide_mapped do
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'sequencer/unit/import/common/model/mixin/handle_failure'
|
require_dependency 'sequencer/unit/import/common/model/mixin/handle_failure'
|
||||||
|
|
||||||
class Sequencer
|
class Sequencer
|
||||||
class Unit
|
class Unit
|
||||||
|
|
|
@ -5,6 +5,9 @@ class Sequencer
|
||||||
module Model
|
module Model
|
||||||
module Associations
|
module Associations
|
||||||
class Extract < Sequencer::Unit::Base
|
class Extract < Sequencer::Unit::Base
|
||||||
|
prepend ::Sequencer::Unit::Import::Common::Model::Mixin::Skip::Action
|
||||||
|
|
||||||
|
skip_any_action
|
||||||
|
|
||||||
uses :model_class, :mapped
|
uses :model_class, :mapped
|
||||||
provides :associations
|
provides :associations
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Sequencer
|
||||||
include ::Sequencer::Unit::Import::Common::Model::Mixin::HandleFailure
|
include ::Sequencer::Unit::Import::Common::Model::Mixin::HandleFailure
|
||||||
prepend ::Sequencer::Unit::Import::Common::Model::Mixin::Skip::Action
|
prepend ::Sequencer::Unit::Import::Common::Model::Mixin::Skip::Action
|
||||||
|
|
||||||
skip_action :skipped
|
skip_action :skipped, :failed
|
||||||
|
|
||||||
uses :mapped, :model_class
|
uses :mapped, :model_class
|
||||||
provides :instance
|
provides :instance
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'sequencer/unit/import/common/model/mixin/handle_failure'
|
require_dependency 'sequencer/unit/import/common/model/mixin/handle_failure'
|
||||||
|
|
||||||
class Sequencer
|
class Sequencer
|
||||||
class Unit
|
class Unit
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'sequencer/unit/common/mixin/dynamic_attribute'
|
require_dependency 'sequencer/unit/common/mixin/dynamic_attribute'
|
||||||
|
|
||||||
class Sequencer
|
class Sequencer
|
||||||
class Unit
|
class Unit
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'sequencer/unit/common/mixin/dynamic_attribute'
|
require_dependency 'sequencer/unit/common/mixin/dynamic_attribute'
|
||||||
|
|
||||||
class Sequencer
|
class Sequencer
|
||||||
class Unit
|
class Unit
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
require 'sequencer/unit/import/common/model/statistics/mixin/action_diff'
|
require_dependency 'sequencer/unit/import/common/model/statistics/mixin/action_diff'
|
||||||
|
|
||||||
class Sequencer
|
class Sequencer
|
||||||
class Unit
|
class Unit
|
||||||
module Import
|
module Import
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'sequencer/unit/import/common/model/statistics/mixin/action_diff'
|
require_dependency 'sequencer/unit/import/common/model/statistics/mixin/action_diff'
|
||||||
|
|
||||||
class Sequencer
|
class Sequencer
|
||||||
class Unit
|
class Unit
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'sequencer/unit/import/common/model/statistics/mixin/action_diff'
|
require_dependency 'sequencer/unit/import/common/model/statistics/mixin/common'
|
||||||
|
|
||||||
class Sequencer
|
class Sequencer
|
||||||
class Unit
|
class Unit
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue