Merge branch 'develop' of git.znuny.com:zammad/zammad into develop

This commit is contained in:
Martin Edenhofer 2018-04-26 23:23:58 +02:00
commit 12fb3c9126
122 changed files with 460 additions and 459 deletions

View file

@ -226,3 +226,9 @@ Lint/AmbiguousBlockAssociation:
Exclude: Exclude:
- "**/*_spec.rb" - "**/*_spec.rb"
- "**/*_examples.rb" - "**/*_examples.rb"
# Special exceptions
Style/HashSyntax:
Exclude:
- "**/*.rake"

View file

@ -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

View file

@ -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 ''

View file

@ -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

View file

@ -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' } ) }

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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') }

View file

@ -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

View file

@ -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'

View file

@ -2,6 +2,7 @@
class ActivityStream class ActivityStream
module Assets module Assets
extend ActiveSupport::Concern
=begin =begin

View file

@ -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

View file

@ -2,6 +2,7 @@
class Channel class Channel
module Assets module Assets
extend ActiveSupport::Concern
=begin =begin

View file

@ -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|

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -2,9 +2,6 @@
# encoding: utf-8 # encoding: utf-8
require 'mail'
require 'encode'
class Channel::EmailParser class Channel::EmailParser
=begin =begin

View file

@ -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

View file

@ -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

View file

@ -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
@ -80,3 +83,4 @@ returns
end end
end end
end end
end

View file

@ -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
@ -32,5 +36,6 @@ returns
attributes attributes
end end
end
end end

View file

@ -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

View file

@ -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'

View file

@ -2,6 +2,7 @@
class History class History
module Assets module Assets
extend ActiveSupport::Concern
=begin =begin

View file

@ -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

View file

@ -2,6 +2,7 @@
class Job class Job
module Assets module Assets
extend ActiveSupport::Concern
=begin =begin

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -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

View file

@ -2,6 +2,7 @@
class OnlineNotification class OnlineNotification
module Assets module Assets
extend ActiveSupport::Concern
=begin =begin

View file

@ -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

View file

@ -2,6 +2,7 @@
class Organization class Organization
module Assets module Assets
extend ActiveSupport::Concern
=begin =begin

View file

@ -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
@ -104,3 +108,4 @@ returns
end end
end end
end end
end

View file

@ -2,6 +2,7 @@
class Organization class Organization
module SearchIndex module SearchIndex
extend ActiveSupport::Concern
=begin =begin

View file

@ -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'

View file

@ -2,6 +2,7 @@
class Overview class Overview
module Assets module Assets
extend ActiveSupport::Concern
=begin =begin

View file

@ -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

View file

@ -2,6 +2,7 @@
class RecentView class RecentView
module Assets module Assets
extend ActiveSupport::Concern
=begin =begin

View file

@ -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

View file

@ -2,6 +2,7 @@
class Role class Role
module Assets module Assets
extend ActiveSupport::Concern
=begin =begin

View file

@ -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,10 +121,15 @@ 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
log_start_finish(:info, 'Cleanup of left over locked delayed jobs') do
Delayed::Job.all.each do |job| Delayed::Job.all.each do |job|
log_start_finish(:info, "Checking left over delayed job #{job.inspect}") do
cleanup_delayed(job) cleanup_delayed(job)
end end
end end
end
end
# Checks if the given job can be rescheduled or destroys it. Logs the action as warn. # Checks if the given job can be rescheduled or destroys it. Logs the action as warn.
# Works only for locked jobs. Jobs that are not locked are ignored and # Works only for locked jobs. Jobs that are not locked are ignored and
@ -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)

View file

@ -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

View file

@ -2,6 +2,7 @@
class Sla class Sla
module Assets module Assets
extend ActiveSupport::Concern
=begin =begin

View file

@ -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'

View 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

View 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 Object < ApplicationModel class Object < ApplicationModel
validates :name, presence: true validates :name, presence: true
end end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
@ -189,3 +193,4 @@ returns
tickets tickets
end end
end end
end

View file

@ -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

View file

@ -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

View file

@ -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
) )

View file

@ -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

View file

@ -2,6 +2,7 @@
class Trigger class Trigger
module Assets module Assets
extend ActiveSupport::Concern
=begin =begin

View file

@ -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'

View file

@ -2,6 +2,7 @@
class User class User
module Assets module Assets
extend ActiveSupport::Concern
=begin =begin

View file

@ -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
@ -116,3 +120,4 @@ returns
end end
end end
end end
end

View file

@ -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

View file

@ -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

View file

@ -1,4 +1,3 @@
#require 'iconv'
module Encode module Encode
def self.conv (charset, string) def self.conv (charset, string)

View file

@ -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

View file

@ -1,4 +1,4 @@
require 'mixin/rails_logger' require_dependency 'mixin/rails_logger'
module Import module Import
class Exchange class Exchange

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,4 +1,4 @@
require 'ticket' require_dependency 'ticket'
module Import module Import
module OTRS module OTRS

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View 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/
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.

View file

@ -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]

View file

@ -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]

View file

@ -1,5 +1,5 @@
require 'ldap' require_dependency 'ldap'
require 'ldap/user' require_dependency 'ldap/user'
module MigrationJob module MigrationJob
class LdapSamaccountnameToUid class LdapSamaccountnameToUid

View file

@ -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

View file

@ -1,4 +1,4 @@
require 'sequencer/mixin/prefixed_constantize' require_dependency 'sequencer/mixin/prefixed_constantize'
class Sequencer class Sequencer
class Sequence class Sequence

View file

@ -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

View file

@ -1,4 +1,4 @@
require 'sequencer/mixin/prefixed_constantize' require_dependency 'sequencer/mixin/prefixed_constantize'
class Sequencer class Sequencer
class Unit class Unit

View file

@ -1,4 +1,4 @@
require 'mixin/rails_logger' require_dependency 'mixin/rails_logger'
class Sequencer class Sequencer
class Unit class Unit

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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