diff --git a/config/application.rb b/config/application.rb index de7727cc0..bf075637a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -16,7 +16,7 @@ module Zammad # -- all .rb files in that directory are automatically loaded. # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) + config.autoload_paths += Dir["#{config.root}/lib/**/"] # Only load the plugins named here, in the order given (default is alphabetical). # :all can be used as a placeholder for all plugins not explicitly named. @@ -25,12 +25,13 @@ module Zammad # Activate observers that should always be running. # config.active_record.observers = :cacher, :garbage_collector, :forum_observer config.active_record.observers = - :history_observer, - 'ticket::_observer::_first_response', - 'ticket::_observer::_last_contact', - 'ticket::_observer::_close_time', - 'ticket::_observer::_user_ticket_counter', - 'ticket::_observer::_notification' + 'observer::_history', + 'observer::_ticket::_first_response', + 'observer::_ticket::_last_contact', + 'observer::_ticket::_close_time', + 'observer::_ticket::_user_ticket_counter', + 'observer::_ticket::_notification', + 'observer::_tag::_ticket_history' # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. diff --git a/config/environment.rb b/config/environment.rb index 3c4217666..29bc2bc2f 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,27 +1,5 @@ # Load the rails application require File.expand_path('../application', __FILE__) -# load session helper -require 'session_helper' - -# load module used to get current user for active recorde observer -require 'user_info' - -# load omniauth strategies with database lookups api keys at runtime -require 'twitter_database' -require 'facebook_database' -require 'linked_in_database' -require 'google_oauth2_database' - -# load notification factory (replace all tags) -require 'notification_factory' - -# load lib -require 'gmaps' -require 'rss' -require 'cache' - -require 'web_socket' - # Initialize the rails application Zammad::Application.initialize! diff --git a/lib/facebook_database.rb b/lib/facebook_database.rb index e0bb22bfb..1512d3e64 100644 --- a/lib/facebook_database.rb +++ b/lib/facebook_database.rb @@ -1,20 +1,14 @@ -module OmniAuth - module Strategies +class FacebookDatabase < OmniAuth::Strategies::Facebook + option :name, 'facebook' - class FacebookDatabase < OmniAuth::Strategies::Facebook - option :name, 'facebook' + def initialize(app, *args, &block) - def initialize(app, *args, &block) - - # database lookup + # database lookup # puts 'FacebookDatabase -> initialize' - config = Setting.get('auth_facebook_credentials') || {} - args[0] = config['app_id'] - args[1] = config['app_secret'] - super - end - - end - + config = Setting.get('auth_facebook_credentials') || {} + args[0] = config['app_id'] + args[1] = config['app_secret'] + super end + end diff --git a/lib/google_oauth2_database.rb b/lib/google_oauth2_database.rb index ce1c3433f..d7046c3e8 100644 --- a/lib/google_oauth2_database.rb +++ b/lib/google_oauth2_database.rb @@ -1,20 +1,14 @@ -module OmniAuth - module Strategies +class GoogleOauth2Database < OmniAuth::Strategies::GoogleOauth2 + option :name, 'google_oauth2' - class GoogleOauth2Database < OmniAuth::Strategies::GoogleOauth2 - option :name, 'google_oauth2' + def initialize(app, *args, &block) - def initialize(app, *args, &block) - - # database lookup + # database lookup # puts 'GoogleOauth2Database -> initialize' - config = Setting.get('auth_google_oauth2_credentials') || {} - args[0] = config['client_id'] - args[1] = config['client_secret'] - super - end - - end - + config = Setting.get('auth_google_oauth2_credentials') || {} + args[0] = config['client_id'] + args[1] = config['client_secret'] + super end + end diff --git a/lib/linked_in_database.rb b/lib/linked_in_database.rb index 8c008df00..e7b48fabb 100644 --- a/lib/linked_in_database.rb +++ b/lib/linked_in_database.rb @@ -1,20 +1,14 @@ -module OmniAuth - module Strategies +class LinkedInDatabase < OmniAuth::Strategies::LinkedIn + option :name, 'linkedin' - class LinkedInDatabase < OmniAuth::Strategies::LinkedIn - option :name, 'linkedin' + def initialize(app, *args, &block) - def initialize(app, *args, &block) - - # database lookup + # database lookup # puts 'LinkedInDatabase -> initialize' - config = Setting.get('auth_linkedin_credentials') || {} - args[0] = config['app_id'] - args[1] = config['app_secret'] - super - end - - end - + config = Setting.get('auth_linkedin_credentials') || {} + args[0] = config['app_id'] + args[1] = config['app_secret'] + super end + end diff --git a/lib/omniauth/strategies/twitter_database.rb b/lib/omniauth/strategies/twitter_database.rb deleted file mode 100644 index cedf6ce0a..000000000 --- a/lib/omniauth/strategies/twitter_database.rb +++ /dev/null @@ -1,20 +0,0 @@ -module OmniAuth - module Strategies - - class TwitterDatabase < OmniAuth::Strategies::Twitter - option :name, 'twitter' - - def initialize(app, *args, &block) - - # database lookup -# puts 'TwitterDatabase -> initialize' - config = Setting.get('auth_twitter_credentials') || {} - args[0] = config['key'] - args[1] = config['secret'] - super - end - - end - - end -end diff --git a/lib/twitter_database.rb b/lib/twitter_database.rb new file mode 100644 index 000000000..a168321f9 --- /dev/null +++ b/lib/twitter_database.rb @@ -0,0 +1,15 @@ +class TwitterDatabase < OmniAuth::Strategies::Twitter + option :name, 'twitter' + + def initialize(app, *args, &block) + require 'Setting' + + # database lookup +# puts 'TwitterDatabase -> initialize' + config = Setting.get('auth_twitter_credentials') || {} + args[0] = config['key'] + args[1] = config['secret'] + super + end + +end